From 9dc6f19c76a30af26a9b7df614ca25c89b7c4e0f Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 06:33:25 +0000 Subject: automatic import of python-config-env --- .gitignore | 1 + python-config-env.spec | 360 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 362 insertions(+) create mode 100644 python-config-env.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..8e69b39 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/config_env-0.0.19.tar.gz diff --git a/python-config-env.spec b/python-config-env.spec new file mode 100644 index 0000000..51b69f4 --- /dev/null +++ b/python-config-env.spec @@ -0,0 +1,360 @@ +%global _empty_manifest_terminate_build 0 +Name: python-config-env +Version: 0.0.19 +Release: 1 +Summary: Manage enviroment variables +License: MIT License +URL: https://github.com/raslanribeiro/config_env +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/12/17/beb20010a1799e1be22c6fa4a9a0896a8407f670c2af19729c294aef52dd/config_env-0.0.19.tar.gz +BuildArch: noarch + + +%description +# About + +Package to manage environment variables similar to npm config from nodejs + +## Start + +```bash +pip install config_env +mkdir configenv +vi configenv/default.json +``` + +```json +// default.json +{ + // Customer module configs + "Customer": { + "dbConfig": { + "host": "localhost", + "port": 5984, + "dbName": "customers" + }, + "credit": { + "initialLimit": 100, + // Set low for development + "initialDays": 1 + } + } +} +``` + +```bash +vi configenv/production.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "host": "prod-db-server" + }, + "credit": { + "initialDays": 30 + } + } +} +``` + +And if is necessary to hide secret values, it is recommended to use custom_environment_varibles.json to get environment variables: + +```bash +vi configenv/custom_environment_varibles.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "user": "MY_USERNAME", + "password": "MY_PASSWORD" + } + } +} +``` + +Values preference order: + +- custom_environment_varibles -> production -> default + +If custom_environment_varibles.json file does not exist or do not contain some key:value, it will come from produciton.json. + +If producion.json file does not exist or do not contain some key:value, it will come from default.json. + +## Using config_env + +The name of the environment variable PYTHON_ENV must be the same as your json file created. +If PYTHON_ENV is not defined, the values defined in default.json will be used. + +Example: + +```bash +export PYTHON_ENV=production +``` + +```python +# app.py +from config_env import ConfigEnv + +config = ConfigEnv() + +customer_host = config.get("Customer.dbConfig.host") + +customer_credit = config.get("Customer.credit") +``` + + + + +%package -n python3-config-env +Summary: Manage enviroment variables +Provides: python-config-env +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-config-env +# About + +Package to manage environment variables similar to npm config from nodejs + +## Start + +```bash +pip install config_env +mkdir configenv +vi configenv/default.json +``` + +```json +// default.json +{ + // Customer module configs + "Customer": { + "dbConfig": { + "host": "localhost", + "port": 5984, + "dbName": "customers" + }, + "credit": { + "initialLimit": 100, + // Set low for development + "initialDays": 1 + } + } +} +``` + +```bash +vi configenv/production.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "host": "prod-db-server" + }, + "credit": { + "initialDays": 30 + } + } +} +``` + +And if is necessary to hide secret values, it is recommended to use custom_environment_varibles.json to get environment variables: + +```bash +vi configenv/custom_environment_varibles.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "user": "MY_USERNAME", + "password": "MY_PASSWORD" + } + } +} +``` + +Values preference order: + +- custom_environment_varibles -> production -> default + +If custom_environment_varibles.json file does not exist or do not contain some key:value, it will come from produciton.json. + +If producion.json file does not exist or do not contain some key:value, it will come from default.json. + +## Using config_env + +The name of the environment variable PYTHON_ENV must be the same as your json file created. +If PYTHON_ENV is not defined, the values defined in default.json will be used. + +Example: + +```bash +export PYTHON_ENV=production +``` + +```python +# app.py +from config_env import ConfigEnv + +config = ConfigEnv() + +customer_host = config.get("Customer.dbConfig.host") + +customer_credit = config.get("Customer.credit") +``` + + + + +%package help +Summary: Development documents and examples for config-env +Provides: python3-config-env-doc +%description help +# About + +Package to manage environment variables similar to npm config from nodejs + +## Start + +```bash +pip install config_env +mkdir configenv +vi configenv/default.json +``` + +```json +// default.json +{ + // Customer module configs + "Customer": { + "dbConfig": { + "host": "localhost", + "port": 5984, + "dbName": "customers" + }, + "credit": { + "initialLimit": 100, + // Set low for development + "initialDays": 1 + } + } +} +``` + +```bash +vi configenv/production.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "host": "prod-db-server" + }, + "credit": { + "initialDays": 30 + } + } +} +``` + +And if is necessary to hide secret values, it is recommended to use custom_environment_varibles.json to get environment variables: + +```bash +vi configenv/custom_environment_varibles.json +``` + +```json +{ + "Customer": { + "dbConfig": { + "user": "MY_USERNAME", + "password": "MY_PASSWORD" + } + } +} +``` + +Values preference order: + +- custom_environment_varibles -> production -> default + +If custom_environment_varibles.json file does not exist or do not contain some key:value, it will come from produciton.json. + +If producion.json file does not exist or do not contain some key:value, it will come from default.json. + +## Using config_env + +The name of the environment variable PYTHON_ENV must be the same as your json file created. +If PYTHON_ENV is not defined, the values defined in default.json will be used. + +Example: + +```bash +export PYTHON_ENV=production +``` + +```python +# app.py +from config_env import ConfigEnv + +config = ConfigEnv() + +customer_host = config.get("Customer.dbConfig.host") + +customer_credit = config.get("Customer.credit") +``` + + + + +%prep +%autosetup -n config-env-0.0.19 + +%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-config-env -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 0.0.19-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..d7afec1 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +7bdfdcf69d7258e75ebdb1d898e30d4e config_env-0.0.19.tar.gz -- cgit v1.2.3