{"id":24708342,"url":"https://github.com/surface-security/django-environ-ppb","last_synced_at":"2025-03-22T06:14:19.511Z","repository":{"id":44777799,"uuid":"449374322","full_name":"surface-security/django-environ-ppb","owner":"surface-security","description":"PPB extension of https://github.com/joke2k/django-environ","archived":false,"fork":false,"pushed_at":"2024-06-14T09:20:34.000Z","size":34,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T07:40:20.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/surface-security.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-18T17:05:27.000Z","updated_at":"2024-06-14T09:19:40.000Z","dependencies_parsed_at":"2025-01-27T06:41:53.060Z","dependency_job_id":null,"html_url":"https://github.com/surface-security/django-environ-ppb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fdjango-environ-ppb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fdjango-environ-ppb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fdjango-environ-ppb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surface-security%2Fdjango-environ-ppb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surface-security","download_url":"https://codeload.github.com/surface-security/django-environ-ppb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244913329,"owners_count":20530817,"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":"2025-01-27T06:31:35.347Z","updated_at":"2025-03-22T06:14:19.484Z","avatar_url":"https://github.com/surface-security.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-environ\n\n[django-environ](https://github.com/joke2k/django-environ) is the Python package that allows you to use [Twelve-factor methodology](http://www.12factor.net/) to configure your Django application with environment variables.\n\nThis is the PPB extension of it adding `_VAULT` and `_FILE` support to environment variable name parsing to read the setting from (respectivelly) that vault key or that file.\n\nThis should probably be a fork of the package instead of keeping it as a separate package.. TODO.\n\n\n## Usage\n\nRefer to [testapp](testapp) for a working example.\n\nAs in [testapp settings](testapp/testapp/settings.py), initialize environ:\n\n```python\nimport ppbenviron\n\nENV_VAR = ppbenviron.CustomEnv()\nENV_VAR.read_env(BASE_DIR / 'local.env')\n\nENV_VAR.setup_vault(\n    'ENVTEST_VAULT_URL',\n    'ENVTEST_VAULT_TOKEN',\n    'ENVTEST_VAULT_MOUNT',\n    'ENVTEST_VAULT_PATHS',\n    default_url='http://vault.local',\n    default_token='tok3n',\n    default_mount='/secrets',\n    default_paths='staging,production',\n)\n```\n\nDefine settings:\n\n```python\nTEST_SETTING_STR = ENV_VAR('ENVTEST_STR', default='missed')\nTEST_SETTING_LIST = ENV_VAR('ENVTEST_LIST', default=['missed'])\n```\n\nCreate a `testapp/local.env` or define the environment variabls in the current shell:\n\n```env\nENVTEST_VAULT_TOKEN_FILE=/home/myuser/.vault-token\nENVTEST_VAULT_MOUNT=other_mount\nENVTEST_VAULT_PATHS=dev,prd\n```\n\n`ENVTEST_STR_FILE=/path/to/file` will load `/path/to/file` in `TEST_SETTING_STR`.\n\n`ENVTEST_STR_VAULT=somepath` will load `/other_mount/prd[somepath]` in `TEST_SETTING_STR` if it exists otherwise fallback to `/other_mount/qa[somepath]`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurface-security%2Fdjango-environ-ppb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurface-security%2Fdjango-environ-ppb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurface-security%2Fdjango-environ-ppb/lists"}