FYI, in case it’s helpful, you should put singular values in your toml file above key group values, otherwise those singular values will be combined into the key group immediately above. Also the secrets.toml file is only special because it’s available via the Streamlit API and protected in Streamlit Cloud. Otherwise, you can create your own toml files and access them using the toml python package. E.g. for general config (not secrets!), I often do this:
import os
import toml
dir = os.path.abspath(os.path.dirname(__file__))
if os.path.isfile(os.path.join(dir, 'custom_config.toml')):
service_settings = toml.load(os.path.join(dir, 'custom_config.toml'))
else:
service_settings = toml.load(os.path.join(dir, 'default_config.toml'))
So, if I’m sharing code with collaborators or on GitHub, I can include the default_config.toml
and not my custom_config.toml
.