I have an application and currently it's set so one of the scripts config.py reads data from a config.yaml configuration file and also sets some defaults. This works nicely thus far as everything is defined in one place.
I now want to pass the application arguments from the CLI. How would I do this so I can also replace arguments in the config.py? I am likely structuring the application suboptimally, so any feedback is appreciated.
I see an extensive post on this here: Most Pythonic way to provide global configuration variables in config.py?
I am currently following the top simple "conventional" approach mentioned, i.e.:
config.py
MYSQL_PORT = 3306
MYSQL_DATABASE = 'mydb'
MYSQL_DATABASE_TABLES = ['tb_users', 'tb_groups']
Therefore global variables are imported in one of the following ways:
another_script.py
from config import MYSQL_PORT
Can I encapsulate everything in my config in an object or class without having to change all of the code importing from config.py.