Skip to content

onlineconf/onlineconf-python

Repository files navigation

onlineconf

onlineconf python library for reading configuration files generated by OnlineConf.

Features

  • read config from CDB file with scheduled reloading
  • supported value formats: string, JSON
  • command line tool for converting config from YAML to CDB format

Installation

Clone the repository and execute:

python setup.py install

Usage

Read config from CDB file

import asyncio
from onlineconf import Config

async def main():
    config = await Config.read(filename='config.cdb', reload_interval=30)
    value = config.get('/service/param_name')
    print(value)

    await config.shutdown()

asyncio.run(main())

Convert YAML to CDB

fill_config config.yaml config.cdb

YAML config file example

service:
  first_level:
    second_level:
      string: string_value
      integer: 100 # returned as string
      float: 1.25 # returned as string
  json_list: [first_value, second_value] # returned as python list
  json: > # returned as python dict
    {
      "param": "value"
    }

Tests

python -m unittest tests

About

Python library for reading OnlineConf files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages