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

Uploaded Python 3

File details

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

File metadata

  • Download URL: savcfg-0.4.0.tar.gz
  • Upload date:
  • Size: 77.9 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

Hashes for savcfg-0.4.0.tar.gz
Algorithm Hash digest
SHA256 02d6568f27d3d37cb60d32f9743996ad077a831abe41c865095f1696bda9c85b
MD5 9256375a84e4b5a5466497f23f3971ab
BLAKE2b-256 8d06cc1de74c3aaef8258ae95d7ee114e56524013fdf271127c1e5addc156ec0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: savcfg-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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

Hashes for savcfg-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc1a65f553ed7da2747e4519cb96c62343b5135cbf39e24d4d6f5c49b6f67c4a
MD5 2012c27152c7fd729546d5ebe2e9d380
BLAKE2b-256 da41917d0c636b9b76481ca1329f081dbc172a789b81302b96e6f09b284bc0f1

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