I have API key for my webapp which I saved and stored in .streamlit/secrets.toml ( which was not uploaded ofcourse in my github repo synced with the render webservice instance). But under the “Secrets” section for deployment of the webservice, it doesn’t allow me to define this way and I can only create it at root which is not as per the standard laid out by streamlit framework:
I’m not familiar with Streamlit or its secret management, but it feels like there are a couple of ways to resolve this:
If all your secrets are root-level in the secrets.toml it seems you can reference them through environment variables in your code. You would update your code to access the secrets like os.environ["secret_key_name"] and then add your secrets as environment variables on the “Environment” tab of your service.
Alternatively, you may be able to use the secrets.toml by creating a secret file (again on the “Environment” tab of your service) and copy it to where it needs to as part of your Build Command, maybe something like.