{"id":19889528,"url":"https://github.com/tsmx/secure-config-test","last_synced_at":"2025-03-01T04:44:13.894Z","repository":{"id":116727637,"uuid":"297149736","full_name":"tsmx/secure-config-test","owner":"tsmx","description":"Test project for using @tsmx/secure-config including Docker/Kubernetes","archived":false,"fork":false,"pushed_at":"2025-01-02T21:53:14.000Z","size":63,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T19:23:43.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/tsmx.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":"2020-09-20T19:36:21.000Z","updated_at":"2025-01-02T21:53:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"3cae119c-fcde-412c-803f-db7821bebe4a","html_url":"https://github.com/tsmx/secure-config-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsmx%2Fsecure-config-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsmx%2Fsecure-config-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsmx%2Fsecure-config-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsmx%2Fsecure-config-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsmx","download_url":"https://codeload.github.com/tsmx/secure-config-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241317601,"owners_count":19943202,"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":[],"created_at":"2024-11-12T18:10:38.418Z","updated_at":"2025-03-01T04:44:13.874Z","avatar_url":"https://github.com/tsmx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# secure-config-test\n\nTest project for using [@tsmx/secure-config](https://www.npmjs.com/package/@tsmx/secure-config) including Docker/Kubernetes.\n\nTo get all information about the secure-config package also check out the [full documentation](https://tsmx.net/secure-config/).\n\n## What it does\n\nStarts a simple service on `http://localhost:3000` and returns the entire loaded configuration JSON on `GET /` as it would be returned to your code by secure-config. \n\nThe provided sample configuration only contains one encrypted entry `test-entry` and an additional `__hmac` to show the validation feature in the production stage:\n\n- Development stage\n  - NODE_ENV: not set\n  - Decrypted value of `test-entry` is: `test-value`\n  - HMAC validation: off\n  - Complete configuration file `config.json`:\n    ```json\n    {\n      \"test-entry\": \"ENCRYPTED|aebc07dd97af3f857cb585b4c956661b|ea18ce1feaa5b8cf4ecb471b9b4401da\"\n    }\n    ```\n- Production stage\n  - NODE_ENV: `production`\n  - Decrypted value of `test-entry` is: `test-value-production`\n  - HMAC validation: on\n  - Complete configuration file `config-production.json`:\n    ```json\n    {\n      \"test-entry\": \"ENCRYPTED|118aa2accf12859bf15fbed018d61092|d7665b354608478b6c3e7452248bb65f0c864edc14adf97470016bcfdcaa3f7b\",\n      \"__hmac\": \"b6a06dbae73b1718a3fd38bce9b1343ad0933645f92cc77f33e220e3b3896577\"\n    }\n    ```\n\nThe encryption key used is 32 times zero: `00000000000000000000000000000000`. See the sections below on how to set it according to the environment you run the test in (local/Docker/Kubernetes).\n\nThe expected result when calling the service at `http://localhost:3000/` is:\n\nWithout having NODE_ENV set...\n```json\n{\n  \"test-entry\": \"test-value\"\n}\n```\n\nWith having NODE_ENV set to `production`...\n```json\n{\n  \"test-entry\": \"test-value-production\",\n  \"__hmac\": \"b6a06dbae73b1718a3fd38bce9b1343ad0933645f92cc77f33e220e3b3896577\"\n}\n```\n\n## Testing locally\n\nFor running in Development stage:\n\n```bash\nexport CONFIG_ENCRYPTION_KEY=00000000000000000000000000000000\nnode app.js\n```\n\nFor running in Production stage:\n\n```bash\nexport CONFIG_ENCRYPTION_KEY=00000000000000000000000000000000\nexport NODE_ENV=production\nnode app.js\n```\n\n## Testing with Docker\n\nSimply run the provided [image from docker-hub](https://hub.docker.com/r/tsmx/secure-config-test) with the needed environment variables and then head over to `http://localhost:3000/` or simply curl it.\n\nFor running in Development stage:\n\n```bash\ndocker run -d \\\n  --env CONFIG_ENCRYPTION_KEY=00000000000000000000000000000000 \\\n  -p 3000:3000 \\\n  tsmx/secure-config-test\n```\n```bash\ncurl localhost:3000\n{\"test-entry\":\"test-value\"}\n```\n\nFor running in Production stage:\n\n```bash\ndocker run --d \\\n  --env CONFIG_ENCRYPTION_KEY=00000000000000000000000000000000 \\\n  --env NODE_ENV=production \\\n  -p 3000:3000 \\\n  tsmx/secure-config-test\n```\n\n```bash\ncurl localhost:3000\n{\"test-entry\":\"test-value-production\",\"__hmac\":\"b6a06dbae73b1718a3fd38bce9b1343ad0933645f92cc77f33e220e3b3896577\"}\n```\n\nIf you want to create a Docker image on your own, the needed Dockerfile is provided in the repositories main folder. To build the image simply run:\n\n```bash\ndocker build -t tsmx/secure-config-test .\n```\n\n## Testing with Kubernetes\n\nComing soon...\n\nTemporary hints:\n\n```bash\nkubectl create secret generic configuration --from-literal encryptionkey=00000000000000000000000000000000\n```\n\n```yaml\nenv:\n  - name: CONFIG_ENCRYPTION_KEY\n    valueFrom:\n      secretKeyRef:\n        name: configuration\n        key: encryptionkey\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsmx%2Fsecure-config-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsmx%2Fsecure-config-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsmx%2Fsecure-config-test/lists"}