From 20ce34e51ad4aa502f7f0a8611d2937dbcc2af2f Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 07:05:55 +0000 Subject: automatic import of python-get-docker-secret --- .gitignore | 1 + python-get-docker-secret.spec | 225 ++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 227 insertions(+) create mode 100644 python-get-docker-secret.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..22072e7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 +[![version](https://img.shields.io/pypi/v/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![license](https://img.shields.io/pypi/l/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pyversions](https://img.shields.io/pypi/pyversions/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pipeline status](https://travis-ci.org/Fischerfredl/get-docker-secret.svg?branch=master)](https://travis-ci.org/Fischerfredl/get-docker-secret) +[![coverage](https://img.shields.io/codecov/c/github/fischerfredl/get-docker-secret.svg)](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 +[![version](https://img.shields.io/pypi/v/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![license](https://img.shields.io/pypi/l/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pyversions](https://img.shields.io/pypi/pyversions/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pipeline status](https://travis-ci.org/Fischerfredl/get-docker-secret.svg?branch=master)](https://travis-ci.org/Fischerfredl/get-docker-secret) +[![coverage](https://img.shields.io/codecov/c/github/fischerfredl/get-docker-secret.svg)](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 +[![version](https://img.shields.io/pypi/v/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![license](https://img.shields.io/pypi/l/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pyversions](https://img.shields.io/pypi/pyversions/get-docker-secret.svg)](https://pypi.python.org/pypi/get-docker-secret) +[![pipeline status](https://travis-ci.org/Fischerfredl/get-docker-secret.svg?branch=master)](https://travis-ci.org/Fischerfredl/get-docker-secret) +[![coverage](https://img.shields.io/codecov/c/github/fischerfredl/get-docker-secret.svg)](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 - 1.0.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..0603560 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +b93a5d5166dfd0c24bd7cea1fbeedc9f get-docker-secret-1.0.2.tar.gz -- cgit v1.2.3