Skip to content

Allow environment variables to be used to set CLI options #476

@kinghuang

Description

@kinghuang

Problem

I'd like to be able to set Streamlit CLI options using environment variables. I'm running Streamlit in containers, and it would be handier to set things like the server port as an environment variable than having to edit the command.

Solution

Since Streamlit uses Click for CLI handling, the most straightforward solution is to set the auto_envvar_prefix argument when invoking the main entrypoint. I suggest STREAMLIT as the prefix.

Additional context

auto_envvar_prefix is documented under Values from Environment Variables in the Click documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions