-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to env setup, datadog usage (#7)
- Make Datadog optional - Enforce datadog>=0.36.0 to auto-tag `DD_*` environment variables - Move environment settings to config module - Start namespacing vaultpy env vars with VAULTPY_ to avoid collision extract environment variables to config module make datadog optional, simplify
- Loading branch information
Tim Loyer
authored
Mar 11, 2021
1 parent
de3e2ba
commit 36a3e9d
Showing
3 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = vaultpy | ||
version = 0.0.5 | ||
version = 0.0.6 | ||
author = Tim Loyer | ||
author_email = [email protected] | ||
description = A module to parse injected Vault secrets and track their usage with Datadog. | ||
|
@@ -12,4 +12,4 @@ url = https://github.com/DirectEmployers/vaultpy | |
packages = find: | ||
python_requires = >=3.6 | ||
install_requires = | ||
datadog | ||
datadog>=0.36.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from os import environ | ||
|
||
|
||
def parse_env_bool(env: str) -> bool: | ||
return env.casefold() in ["true", "1"] | ||
|
||
|
||
# We're defaulting this to False until everything using vaultpy uses Vault. | ||
# When True, vaultpy will attempt to retrieve and parse Vault agent injected secrets. | ||
# When False vaultpy fallback on loading secrets from the de_secrets module. | ||
# TODO: Remove USE_VAULT when all code has been updated to use VAULTPY_* | ||
ENABLE_VAULT = parse_env_bool( | ||
environ.get("VAULTPY_ENABLE_VAULT", environ.get("USE_VAULT", "false")) | ||
) | ||
|
||
# Absolute path to get secrets from when VAULTPY_ENABLE_VAULT=true | ||
# TODO: Remove VAULT_SECRETS_PATH when all code has been updated to use VAULTPY_* | ||
SECRETS_PATH = environ.get( | ||
"VAULTPY_SECRETS_PATH", environ.get("VAULT_SECRETS_PATH", "/vault/secrets/secrets") | ||
) | ||
|
||
# Enable or disable reporting of secret usage to Datadog. | ||
ENABLE_DATADOG = parse_env_bool(environ.get("VAULTPY_ENABLE_DATADOG", "true")) |