.streamlit/secrets.toml from env variables?

Hi,
Is there a way to populate the content of .streamlit/secrets.toml using env variables? I want to use st.login, but I want the secrets to come from env variables.

I don’t want to commit the secrets to git, nor want them to be hard-coded inside a Docker container.

I tried setting the values directly (see below) but obviously got
TypeError: Secrets does not support item assignment.

st.secrets['auth']['redirect_uri'] = "value"

@Oras my approach is the run a small script before starting streamlit to read the secrets out of environment or secret storage and populate the toml file.

1 Like

Thank you @Ryan13 ! I like this solution.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.