{"id":22048544,"url":"https://github.com/samhammerag/vault-client-sag","last_synced_at":"2026-02-07T08:31:18.410Z","repository":{"id":152580193,"uuid":"626383713","full_name":"SamhammerAG/vault-client-sag","owner":"SamhammerAG","description":"Supports loading configurations from hashicorp vault for JS projects of Samhammer.","archived":false,"fork":false,"pushed_at":"2024-12-05T15:29:47.000Z","size":252,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T23:02:34.512Z","etag":null,"topics":["js-lib","vault"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamhammerAG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-11T11:08:53.000Z","updated_at":"2025-01-17T15:03:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"3c11ad0e-ad0e-406f-b1de-f68f152c8b1b","html_url":"https://github.com/SamhammerAG/vault-client-sag","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fvault-client-sag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fvault-client-sag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fvault-client-sag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamhammerAG%2Fvault-client-sag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamhammerAG","download_url":"https://codeload.github.com/SamhammerAG/vault-client-sag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160770,"owners_count":21863627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["js-lib","vault"],"created_at":"2024-11-30T14:12:44.282Z","updated_at":"2026-02-07T08:31:18.385Z","avatar_url":"https://github.com/SamhammerAG.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vault-client-sag\n\nThis library can be used if you want to load specific keys from vault, but works only for interal usage of Samhammer.\n\nIt uses specific authentication logic:\n\n-   Locally: Uses the url and token returned by sagctl\n-   Kubernetes: Does a kubernetes role auth\n\n## Prerequirements:\n\n### Locally\n\nSagctl has to be installed: https://samhammer.atlassian.net/wiki/spaces/K8S/pages/158793743/How+to+use+sagctl\n\n### In the cluster\n\nUse following environment variables for this configuration:\n\n-   VaultUrl: With the url to vault (required)\n-   VaultKubernetesRole: The vault role of the application (required)\n\n### With AppRole (e.g. for github actions)\n\nUse following environment variables for this configuration:\n\n-   VaultUrl: With the url to vault (required)\n-   VaultAppRoleId: The vault role id of the application (required)\n-   VaultAppRoleSecretId: The vault secret id (password) of the application (required)\n\n## How to add:\n\n-   add this package to package.json of your project: https://www.npmjs.com/package/@samhammer/vault-client-sag\n\n## How to use:\n\nSample with Javascript:\n\n```js\nconst { getVault } = require(\"@samhammer/vault-client-sag\");\n\nconst vaultMap = {\n  [`VaultKey--kv-v2/data/MySecret/Username`]: \"UserName\",\n  [`VaultKey--kv-v2/data/MySecret/Password`]: \"Password\",\n};\n\ngetVault()\n  .then(vault =\u003e vault.loadSecretsToEnv(vaultMap));\n  .then(() =\u003e console.log(`Username: ${process.env.UserName} Password: ${process.env.Password}`);\n```\n\nSample with Typescript:\n\n```ts\nimport { getVault } from \"@samhammer/vault-client-sag\";\n\nconst vaultMap = {\n    [`VaultKey--kv-v2/data/MySecret/Username`]: \"UserName\",\n    [`VaultKey--kv-v2/data/MySecret/Password`]: \"Password\"\n};\n\nconst vault = await getVault();\nawait vault.loadSecretsToEnv(vaultMap);\nconsole.log(`Username: ${process.env.UserName} Password: ${process.env.Password}`);\n```\n\n## Configuration:\n\nAvailable Options:\n\n-   Timeout in milliseconds (default: 3000 )\n    -   as param `getVault({ timeout: 5000 })`\n    -   as env variable `VaultTimeout = 5000`\n\n## How to publish\n\n-   Create \u0026 Push a tag with new version number\n-   The CICD actions will take this version number for npm package automatically\n-   Check github action to validated, that package was released to npm registry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhammerag%2Fvault-client-sag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamhammerag%2Fvault-client-sag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamhammerag%2Fvault-client-sag/lists"}