Skip to main content

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:

  1. A string, if the variable exist. It's the responsability of the developer to convert to the type he needs
  2. A dictionary of strings if the variable name is a group (see below).
  3. None if 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

savcfg-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

savcfg-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file savcfg-0.1.0.tar.gz.

File metadata

  • Download URL: savcfg-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.11.0-1018-azure

File hashes

Hashes for savcfg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82d11f5a47363f6e31ae0508684365d29c4cf76613299296999bc4aec5d52234
MD5 65c4eb013fd98b21087038cf387af728
BLAKE2b-256 d009bf4674bfc6f6c137768512db3e1a85cbb26dac27b831dfb5d4a533445806

See more details on using hashes here.

File details

Details for the file savcfg-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: savcfg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.11.0-1018-azure

File hashes

Hashes for savcfg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82ba10c774e391c32ad459c71d2dc383d08e37caf11f9ca9bee5c669a4c28a7c
MD5 d384add48e2f5f3d7e78cdd10c95f940
BLAKE2b-256 d51b117ac46e94276ef960d4cd58b327f8e539de692d9865e29c828a165c581b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page