podsync icon indicating copy to clipboard operation
podsync copied to clipboard

Feature request: Allow API keys to be set using environment variables

Open MillironX opened this issue 2 years ago • 2 comments

It would be great to be able to use environment variables for the Youtube and Vimeo API keys. This would allow users (including myself) to commit the config.toml file into version control without exposing any secrets.

Proposition

API keys for Youtube and Vimeo can be set using either the [tokens] table in config.toml or can be set using the environment variables PODSYNC_TOKENS_YOUTUBE and PODSYNC_TOKENS_VIMEO. Multiple tokens are separated by commas in the environment variables. This means that running

docker run \
    -p 8080:8080 \
    -e PODSYNC_TOKENS_YOUTUBE=abc123 \
    -e PODSYNC_TOKENS_VIMEO=def456,ghi789 \
    -v $(pwd)/data:/app/data/ \
    -v $(pwd)/config.toml:/app/config.toml \
    mxpv/podsync:latest

would be equivalent to having

[tokens]
youtube = "abc123"
vimeo = [
    "def456",
    "ghi789"
]

in config.toml.

In the case of both environment variables being set and tokens present in config.toml, the environment variable tokens would override any tokens present in config.toml.

MillironX avatar Mar 09 '23 22:03 MillironX

My current workaround for this is just replacing the value in github action with sed.

PylotLight avatar Jul 18 '23 15:07 PylotLight