ConfigService implementation for SAVIA software projects
Project description
Savia config service
Library to centralize the management of config variables for applications. This library is created and used by SAVIA to develop their applications.
Several environments
Each environment has its own variables:
- production environment where all the config variables are centralized in the config service.
- preproduction environment, where the application can run in a very closed environment to production. Some of the variables can be common to production, so there is a merge between the two config variables. It means that if the config service doesn't find the variable in preproduction, it will look in production environment.
- devel: environment where the application run locally and insollated. Their variables should be not related to other environment but only should share the variable name. There is no merge with preproduction or production
Usage
Here you have a example of tipical code:
cs = ConfigService(prod_vars_reader, pre_vars_reader, devel_vars_reader)
cs.set_application('app-name') # optional if you have app-variables
cs.set_environment('pre')
value = cs.get('var-name')
Where there are prod_vars_reader, pred_vars_reader, devel_vars_reader which implements the interface VarsReader
The library has available a implementation with AzureKeyVault and a constructor in savcfg.keyvault called new_keyvault-
Now it is implemented the ConfigService with Azure KeyVault. There is a constructor for this purpose.
The output of method get can be:
- A string, if the variable exist. It's the responsability of the developer to convert to the type he needs
- A dictionary of strings if the variable name is a group (see below).
Noneif the variable doesn't exist. It means the ConfigService will not raise any exception if you have a mistake with the variable names.
Grouping the variables hierardically
Using the dot you can group variables. When a group variable is called, the ConfigService object will return a dictionary of variables.
For example, if we have two variables with names group.var1 and group.var2, a call to get('group') will return {'var1': 'value1', 'var2': 'value2'}
Several applications
Each application has its own variables which can overwrite the general variables. For example, supose you have a infrastructure group group with two variables {'var1': 'value1', 'var2': 'value2'} and you want for your application app-name to overwrite group.var2. If you have a variable defined app-name.group.var2 with value val-app, calling cs.get('group') will return {'var1': 'value1', 'var2': 'val-app'}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file savcfg-0.4.5.tar.gz.
File metadata
- Download URL: savcfg-0.4.5.tar.gz
- Upload date:
- Size: 68.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8770c0d9e184499fb3d9aed69fde2b04661043f958cd655e8a5e1b1a22186292
|
|
| MD5 |
f3e2dfa1d7b75dc3a161ba9e549a8a2f
|
|
| BLAKE2b-256 |
2ceea97a1124a96ec3159c85ac9fd20e155b62932bdcaed45f7ee8cbff602224
|
File details
Details for the file savcfg-0.4.5-py3-none-any.whl.
File metadata
- Download URL: savcfg-0.4.5-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95298001508fe2ba5a6afad4cbc83bc400985f19263cb9a7477b29812ac46e18
|
|
| MD5 |
51189370bc9e75040d4817bf6bddb204
|
|
| BLAKE2b-256 |
1700cbc3040228cdcb885df247836d5fcdd7b485dcd634fc6f05657eec097900
|