From b354858db90156edd611e7bdd043b3a901a8671f Mon Sep 17 00:00:00 2001 From: Tim Loyer Date: Thu, 25 Feb 2021 15:35:29 -0500 Subject: [PATCH] remove build, add ignore file --- .gitignore | 71 +++++++++++++++++++++ .idea/vcs.xml | 6 ++ build/lib/vault/__init__.py | 85 -------------------------- dist/vaultpy-0.0.1-py3-none-any.whl | Bin 2633 -> 0 bytes dist/vaultpy-0.0.1.tar.gz | Bin 2246 -> 0 bytes vaultpy.egg-info/PKG-INFO | 21 ------- vaultpy.egg-info/SOURCES.txt | 8 --- vaultpy.egg-info/dependency_links.txt | 1 - vaultpy.egg-info/top_level.txt | 1 - 9 files changed, 77 insertions(+), 116 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/vcs.xml delete mode 100644 build/lib/vault/__init__.py delete mode 100644 dist/vaultpy-0.0.1-py3-none-any.whl delete mode 100644 dist/vaultpy-0.0.1.tar.gz delete mode 100644 vaultpy.egg-info/PKG-INFO delete mode 100644 vaultpy.egg-info/SOURCES.txt delete mode 100644 vaultpy.egg-info/dependency_links.txt delete mode 100644 vaultpy.egg-info/top_level.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd95a98 --- /dev/null +++ b/.gitignore @@ -0,0 +1,71 @@ +# Editors +.vscode/ +.idea/ + +# Vagrant +.vagrant/ + +# Mac/OSX +.DS_Store + +# Windows +Thumbs.db + +# Source for the following rules: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build/lib/vault/__init__.py b/build/lib/vault/__init__.py deleted file mode 100644 index 97b561e..0000000 --- a/build/lib/vault/__init__.py +++ /dev/null @@ -1,85 +0,0 @@ -import logging -from base64 import b64decode -from importlib import import_module -from json import loads -from os import environ -from typing import Dict - -from datadog import statsd - -logger = logging.getLogger(__name__) - - -def _load_de_secrets() -> Dict: - """ - Imports de_secrets module and returns a dictionary of its attributes. - """ - de_secrets = import_module("de_secrets") - return {k: getattr(de_secrets, k) for k in dir(de_secrets) if not k.startswith("_")} - - -def _load_vault_secrets() -> Dict: - """ - Load Vault injected secrets file located at VAULT_SECRETS_PATH, then perform - base 64 decode followed by JSON decode on file contents. This function - should not be called anywhere except within this module! - """ - with open(environ["VAULT_SECRETS_PATH"]) as file: - contents = file.read() - - json_secrets = b64decode(contents) - return loads(json_secrets) - - -def _get_secrets() -> Dict: - """ - Get secrets from de_secrets.py in local dev, or from Vault injected secrets file - located at path in VAULT_SECRETS_PATH. Performs base 64 decode followed by JSON - decode on file contents. - """ - if not environ.get("USE_VAULT"): - # Use dev secrets when available. - return _load_de_secrets() - - return _load_vault_secrets() - - -class VaultSecretsWrapper: - """ - Provide access to secrets as attributes and send secret-usage analytics to Datadog. - """ - - def __init__(self, secrets: Dict): - self._keys = secrets.keys() - self._env = environ.get("DD_ENV") - - for key, value in secrets.items(): - statsd.increment( - "vault.secrets.access_count", - value=1, - tags=[f"env:{self._env}", f"secret_key:{key}"], - ) - setattr(self, key, value) - - def __getattribute__(self, key: str): - """ - Override the default getattribute method so that we can track secret key - usage with Datadog. Non-secret attributes are passed on to the default method. - """ - if key not in ["_keys", "_env"] and key in self._keys: - try: - statsd.increment( - "vault.secrets.access_count", - value=1, - tags=[f"env:{self._env}", f"secret_key:{key}"], - ) - return super().__getattribute__(key) - except AttributeError as error: - logger.error(f"Requested secret could not be loaded: {key}") - raise error - - return super().__getattribute__(key) - - -secrets = VaultSecretsWrapper(_get_secrets()) -__all__ = ("secrets",) diff --git a/dist/vaultpy-0.0.1-py3-none-any.whl b/dist/vaultpy-0.0.1-py3-none-any.whl deleted file mode 100644 index 331a48045b7fef699533e9d09e4e0b0a9e7cc09e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2633 zcmaKu3pAAZ8^>QpE;B?L8|7NaWG)P9sK|ZHU}hM~rABUWzT&w0;zKIi$p&-eR1KO!C^00jU*7#O(Y zU{f38Ix-0Y0820c?AZ7kdOE}>7)7B_eW}3|3erC;+uq5Whk;&PEW)s8#Y#GG(Rqm} zqk$`xL_LqrPzBtMSj7HRjEz}RvRL*yEkU{Eb`=}WW8`pk^=`ile;w4|Tg0Y27W5ev zCgWIg`6*)x1`)zJJuk#nP~@g4&AYv>QnO=GZ^;AQ1sw4#ckRB|o2s(vJH;!H2p70x z${rrgNyx#I`jw?|o(_3>amB5vXba~8=byvidX%6GuQ)b1mB9d9sj>y`6ko^ywJC3m zKH2*~=I-jOZR^fDhQzqR(C^912lAX#N}(F_j~#nr%WxUUHO$RFw3>WHw9f2FEm zDr=&rV0pTR z6VqH+_Jr-=;;{-NLdEyYlqn$;9HsP;DAI7>ep?WuwSM*4a1Y`na&5V`;$&x9+#pBm z(H`V!j!tjYJfB=5a1}Zgb+r4j-uP;dNG3247yYH#|6bM{YE!IxVG$Q z00Ay`=2y|m$$ZP}?(LI}`Y9phNNSCCYB7ZoeC{FdK*HLS9klT>g{ze73E<_miKQ`5 zGH>p*AXetx{Bta=+P7RH{8|-iO3|OG~nBMcv|mLF{f#iReSiuCoT@VMm$u@%BQI z!^QVUr~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X^CIUdaygilDMl2a-3XgrflI5mtFOow$AHSATN-PD841mw%zkN_f-pfq9q(LRq!0&*n zMk>kYqpOok|6=sv)9CWTKR>$sxUaJFlw>SdR|7RdB}W7V$%qfo5XXED?~fPcUl(Vm zWjn}XHDkNUFCD zum4daP?rpN#?nS1f7kXV9rjI=P($!=dF8QOT2WSTa)_21AY`gf343L)m+I0eU#jh~ zR)r?#~a|Lt2_qo$DEVl$K)H|(p6k*{aBn=AIK`yEUXwOssM$r`<cjP*+?*k$hFEsu~1sI|NHhmbXmd zil#JP$SBY+*6#W$`~~+w9117g5GdL93cEtKq)qM#ld&9yPWW*Aaq z_VKYlI{j=H%u%523|s7zdm7JFMQ({Rk}LtFtC=-sZIYcR4a_~BMy*%Vq`B;rSPaYj zfX`A{oF!I4&wA)>c1SuEhu0GumOuQmr01)>PbRj(t#~l}0{?uqZ|d(i>q{;StYPbl z)@GIUg%#HOxZDCY0Z^P*cu-1&g0p*;=SnQV4k|QS>#B%I!sIOnY2Yvflx?mISz44f z4H0UNCBiLrPIAiARxz|HXkY^~5M5A0&^XC!OE9xKTh|O42s3Iegsr}|wIBggZN**t zMoX|7pyi+xw7Lk$d@pzwHPquK_blOtKlI<7M|L4{J z`)=m|>;G8)NBh6y`oFgSSpP@+U)cW_`40h}|NZ~K^ZHo--v!|J|M>kse*cg8KgNF; z|6%-x@!wkfcX4+0>BH#4kq`2R#ebmw>-qm+;NtgxJAu{x`1-e>*78#jYvWRo_02TF zdQ5;eJ42SSG-PS8@Z%`G6Wd2gp7}AmXYuz*Ap-h;^#ADp5uV}yw^`^H_y6!%*Z)q( z9eC*fcLAvC=>O6GqyI<$kN$s)|9_F(>uLYLrvDwc*F*omyZuLfM?gS8KtMo1KtMo1 UKtMo1_}jvN09=`qlK^-C0L#dl!T=3.6 -Description-Content-Type: text/markdown diff --git a/vaultpy.egg-info/SOURCES.txt b/vaultpy.egg-info/SOURCES.txt deleted file mode 100644 index 0c4a161..0000000 --- a/vaultpy.egg-info/SOURCES.txt +++ /dev/null @@ -1,8 +0,0 @@ -README.md -pyproject.toml -setup.cfg -vault/__init__.py -vaultpy.egg-info/PKG-INFO -vaultpy.egg-info/SOURCES.txt -vaultpy.egg-info/dependency_links.txt -vaultpy.egg-info/top_level.txt \ No newline at end of file diff --git a/vaultpy.egg-info/dependency_links.txt b/vaultpy.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/vaultpy.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/vaultpy.egg-info/top_level.txt b/vaultpy.egg-info/top_level.txt deleted file mode 100644 index 4c0870e..0000000 --- a/vaultpy.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -vault