Overview
In this post we cover a strategy for managing configurations for programs using
a Singleton pattern to create a static Config
class.
This allows the user to create an instance of the Config
class, pointing it
to a specific config file, which it loads into memory.
The Config
class provides several static methods for accessing configuration
options from the config file. Here's an example of its usage:
Config('/path/to/config.json')
if Config.get_foo() == "bar":
do …