Skip to main content

Configuration

CastKeeper is configured using a YAML config file (castkeeper.yml), environment variables, or a mixture of both.

Config files

Config files are loaded by the CastKeeper server when it starts - either from a path specified when starting the server, or from the default CastKeeper config path. Only the first config file found is loaded, following this order:

  1. The path specified as an argument when running the CastKeeper server, e.g. castkeeper serve --config /path/to/my/castkeeper.yml
  2. ./castkeeper.yml - in the current working directory where the CastKeeper server was started.
  3. /etc/castkeeper/castkeeper.yml

Example config file

EnvName: prod
LogLevel: warn
BaseURL: https://castkeeper.example.com
DataPath: /app/data

WebServer:
Port: 8080
CSRFSecretKey: testValueDoNotUseInProd

ObjectStorage:
Driver: awss3
S3Bucket: my-castkeeper-bucket
S3Prefix: podcasts/

Environment variables

Every CastKeeper config option can alternatively be specified as an environment variable.

The names of environment variables follow a convention:

  • the config file option EnvName would become CASTKEEPER_ENVNAME.
  • the nested config file option WebServer.Port would become CASTKEEPER_WEBSERVER_PORT

See the reference table below for the full list of environment variables.

Config reference

Config optionEnvironment variableDescription
LogLevelCASTKEEPER_LOGLEVELLog verbosity. Allowed values: debug,info, warn, error. Default value: info.
EnvNameCASTKEEPER_ENVNAMEThe name of the environment, used in logs. Default value: unknown.
BaseURLCASTKEEPER_BASEURLThe URL that CastKeeper is hosted at, e.g. https://ck.example.com. Required.
DataPathCASTKEEPER_DATAPATHThe path to the directory that CastKeeper uses to store its data, e.g. /app/data. Required.
WebServer.PortCASTKEEPER_WEBSERVER_PORTThe port the web server should listen to. Default value: 8080.
WebServer.CSRFSecretKeyCASTKEEPER_WEBSERVER_CSRFSECRETKEYUnique secret key used to create CSRF tokens. It is very important that this value remains secret. To avoid this key being stored in plain text in the config file, it is recommended that it is provided as an environment variable. Required.
WebServer.CSRFSecureCookieCASTKEEPER_WEBSERVER_CSRFSECURECOOKIEBoolean value - if true, the CSRF cookie has the secure attribute. Should be true in production if CastKeeper is on HTTPS. Default value: true.
ObjectStorage.DriverCASTKEEPER_OBJECTSTORAGE_DRIVERThe object storage provider to use. Allowed values: local, awss3. Required.
ObjectStorage.S3BucketCASTKEEPER_OBJECTSTORAGE_S3BUCKETThe S3 bucket to use for file storage when using the awss3 provider. Required when Driver is awss3.
ObjectStorage.S3PrefixCASTKEEPER_OBJECTSTORAGE_S3PREFIXOptional prefix for files when using the awss3 provider.
ObjectStorage.S3ForcePathStyleCASTKEEPER_OBJECTSTORAGE_S3FORCEPATHSTYLEBoolean value. Usually false, may need to be set to true for some S3 compatible storage services. Default value: false.