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.3.1.tar.gz (4.0 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.3.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: savcfg-0.3.1.tar.gz
  • Upload date:
  • Size: 4.0 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.3.1.tar.gz
Algorithm Hash digest
SHA256 c80bd037f1727d7ebd0f4b60ef4b8109d6c3b2350ecacb86f86167d0b8df1a18
MD5 c1aeeb0d4bf7a5bcccb8e062481b670b
BLAKE2b-256 42a8cfdeda03a0301f13c9b8ffd3eaa1599f9a535d0d4511bdc1e3ad9ce37709

See more details on using hashes here.

File details

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

File metadata

  • Download URL: savcfg-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 030c40dfe6cc972d92647dc2f12a305ca3782f8b44161abc404f8a07383b3a7d
MD5 925c784717290afba28733b347459d5a
BLAKE2b-256 f738ad99d022e8e7370368fd54a6e5ae419ab12299203403cd62e78d2153cc85

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