diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:05:55 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 07:05:55 +0000 |
commit | 20ce34e51ad4aa502f7f0a8611d2937dbcc2af2f (patch) | |
tree | f386bd10e63181fb1c5ca74fa2a31a946c7a813e | |
parent | 96428be1b662c7ba64249ca1d1fce0f7a0ce95d4 (diff) |
automatic import of python-get-docker-secretopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-get-docker-secret.spec | 225 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 227 insertions, 0 deletions
@@ -0,0 +1 @@ +/get-docker-secret-1.0.2.tar.gz diff --git a/python-get-docker-secret.spec b/python-get-docker-secret.spec new file mode 100644 index 0000000..d050999 --- /dev/null +++ b/python-get-docker-secret.spec @@ -0,0 +1,225 @@ +%global _empty_manifest_terminate_build 0 +Name: python-get-docker-secret +Version: 1.0.2 +Release: 1 +Summary: Utility function to fetch docker secrets/envvars. +License: MIT +URL: https://github.com/fischerfredl/get-docker-secret +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a6/f0/af549ef2b12768025d6fb1be792d45e387fb835e3ac3d66b9ff767ed8428/get-docker-secret-1.0.2.tar.gz +BuildArch: noarch + + +%description +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://travis-ci.org/Fischerfredl/get-docker-secret) +[](https://codecov.io/gh/Fischerfredl/get-docker-secret) + +# get-docker-secret + +Utility function to fetch docker secrets/envvars. + +For config values (flask projects) i like to fetch docker secrets and fall back to environment variables for development. This module provides a function to make this a one-liner: use docker secret -> fall back to envvar -> fall back to default value. + +The function also provides the possibility to automatically cast the value or specify a custom directory for secrets. + +Following assumptions are being made (params): + +- `autocast_name=True`: secrets are lower-case, envvars upper-case. automatic conversion of name can be switched off via autocast_name=False +- `cast_to=str`: fill in desired datatype. special case bool: 'True'/'true' will be True. 'False'/'false' will be False +- `getenv=True`: you want to fall back to envvar. can be switched of via getenv=False +- `default=None` +- `safe=True`: returns None if name not found or cast fails. If you want exceptions: safe=False +- `secrets_dir=/var/run/secrets` + +## Usage + +```python +from get_docker_secret import get_docker_secret + +value = get_docker_secret('secret_key', default='very_secret') +``` + +## Testing + +```python +python setup.py test +``` + +not tested under windows + +## Changelog + +### 1.0.2 - 2021-03-19 + +- Fixed: Only strip trailing newlines from secrets file + +### 1.0.1 - 2019-12-07 + +- Fixed: Strip values read from file. + +### 1.0.0 - 2018-01-30 + +- Initial publish + +%package -n python3-get-docker-secret +Summary: Utility function to fetch docker secrets/envvars. +Provides: python-get-docker-secret +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-get-docker-secret +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://travis-ci.org/Fischerfredl/get-docker-secret) +[](https://codecov.io/gh/Fischerfredl/get-docker-secret) + +# get-docker-secret + +Utility function to fetch docker secrets/envvars. + +For config values (flask projects) i like to fetch docker secrets and fall back to environment variables for development. This module provides a function to make this a one-liner: use docker secret -> fall back to envvar -> fall back to default value. + +The function also provides the possibility to automatically cast the value or specify a custom directory for secrets. + +Following assumptions are being made (params): + +- `autocast_name=True`: secrets are lower-case, envvars upper-case. automatic conversion of name can be switched off via autocast_name=False +- `cast_to=str`: fill in desired datatype. special case bool: 'True'/'true' will be True. 'False'/'false' will be False +- `getenv=True`: you want to fall back to envvar. can be switched of via getenv=False +- `default=None` +- `safe=True`: returns None if name not found or cast fails. If you want exceptions: safe=False +- `secrets_dir=/var/run/secrets` + +## Usage + +```python +from get_docker_secret import get_docker_secret + +value = get_docker_secret('secret_key', default='very_secret') +``` + +## Testing + +```python +python setup.py test +``` + +not tested under windows + +## Changelog + +### 1.0.2 - 2021-03-19 + +- Fixed: Only strip trailing newlines from secrets file + +### 1.0.1 - 2019-12-07 + +- Fixed: Strip values read from file. + +### 1.0.0 - 2018-01-30 + +- Initial publish + +%package help +Summary: Development documents and examples for get-docker-secret +Provides: python3-get-docker-secret-doc +%description help +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://pypi.python.org/pypi/get-docker-secret) +[](https://travis-ci.org/Fischerfredl/get-docker-secret) +[](https://codecov.io/gh/Fischerfredl/get-docker-secret) + +# get-docker-secret + +Utility function to fetch docker secrets/envvars. + +For config values (flask projects) i like to fetch docker secrets and fall back to environment variables for development. This module provides a function to make this a one-liner: use docker secret -> fall back to envvar -> fall back to default value. + +The function also provides the possibility to automatically cast the value or specify a custom directory for secrets. + +Following assumptions are being made (params): + +- `autocast_name=True`: secrets are lower-case, envvars upper-case. automatic conversion of name can be switched off via autocast_name=False +- `cast_to=str`: fill in desired datatype. special case bool: 'True'/'true' will be True. 'False'/'false' will be False +- `getenv=True`: you want to fall back to envvar. can be switched of via getenv=False +- `default=None` +- `safe=True`: returns None if name not found or cast fails. If you want exceptions: safe=False +- `secrets_dir=/var/run/secrets` + +## Usage + +```python +from get_docker_secret import get_docker_secret + +value = get_docker_secret('secret_key', default='very_secret') +``` + +## Testing + +```python +python setup.py test +``` + +not tested under windows + +## Changelog + +### 1.0.2 - 2021-03-19 + +- Fixed: Only strip trailing newlines from secrets file + +### 1.0.1 - 2019-12-07 + +- Fixed: Strip values read from file. + +### 1.0.0 - 2018-01-30 + +- Initial publish + +%prep +%autosetup -n get-docker-secret-1.0.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-get-docker-secret -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.2-1 +- Package Spec generated @@ -0,0 +1 @@ +b93a5d5166dfd0c24bd7cea1fbeedc9f get-docker-secret-1.0.2.tar.gz |