I want to provide a config ini file with my python package that will hold sensitive database credentials. How do I provide default config file that will be installed let's say under /etc/config folder? what is the best practice in terms of deploying such config files with packages, installed with pip? I do not like to keep this config file with the rest of the package files.
Thanks!
I just checked how it is done with popular python projects.
django creates a config file that allows pointing to another config file with database connection details, stored in a different place: https://docs.djangoproject.com/en/2.0/ref/databases/#connecting-to-the-database
flask and airflow create default configs under user home folder but then allow to use an environment variable to overwrite location of a config file. Config file stores sensitive data such as database connections or secret keys: http://flask.pocoo.org/docs/0.12/config/#configuring-from-files https://airflow.apache.org/configuration.html
Both methods allow to: 1) distribute default config file and deploy easily with the package install 2) allow storing sensitive config values in a secured folder
airflow also allows encrypting database connection string using a secret key.
Also refer to this post below and some ideas on how to deploy/store your config file: https://stackoverflow.com/a/22554594/473725