Skip to main content

dynamic config management tool

Project description

Dino 🦖

Dynamic config management.

Example usage

# config.yml

client:
  my_client:
    url: example.com
# main.py
import logging
import signal
from dino import Dino, DinoObserver


logging.basicConfig(level=logging.INFO)


def signal_handler(sig, frame):
    logging.info("Shutdown signal received")
    Dino().stop()  # Stop Dino gracefully.


class MyClient(DinoObserver):

    def __init__(self, url):
        self.url = url
        logging.info(f"MyClient initialized. {self.url}")

    def update_config(
        self,
    ):  # implement update_config from DinoObserver to update your configs when Dino notifies.
        self.url = Dino().get_config_value("appconfig", "client.my_client.url")
        logging.info(f"MyClient config updated. {self.url}")


def main():

    # Register your config yaml file.
    Dino().register_config(
        "appconfig",  # Config name
        "./config.yml",  # Yaml file path
        10,  # File read interval in seconds.
    )

    my_client = MyClient(Dino().get_config_value("appconfig", "client.my_client.url"))
    logging.info(f"MyClient url. {my_client.url}")

    Dino().attach(
        [
            my_client,  # Attach your objects which you want to get config updates.
        ]
    )


if __name__ == "__main__":
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)
    main()

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

dinocore-0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

dinocore-0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file dinocore-0.1.tar.gz.

File metadata

  • Download URL: dinocore-0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for dinocore-0.1.tar.gz
Algorithm Hash digest
SHA256 3cef41f3ab5b9bd5296aa234e7d4326906ea27f65a3fcd1e07d5647c60772a0b
MD5 6a7ad977ddd9f5f85e7da90ae2c5314a
BLAKE2b-256 22db64c91a81e0e24472fae995c7d07411c8145c4a4607e9717ee7f8474e667a

See more details on using hashes here.

File details

Details for the file dinocore-0.1-py3-none-any.whl.

File metadata

  • Download URL: dinocore-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for dinocore-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38cbaa7f7738e9996c78a0805bf5a858ae7d9b9933548b81dc734106dda6ec92
MD5 8680185ac4dddf1d6d9ca173355899b8
BLAKE2b-256 2e3621c6aca9fbea7ac6230b7a98896e608342fac3007d8321b134c56d90db2d

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