-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from purple-emily/change-to-single-env-file
Simplify the environment variables
- Loading branch information
Showing
25 changed files
with
587 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# General environment variables | ||
TZ=London/Europe | ||
|
||
# PostgreSQL | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PORT=5432 | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_DB=knightcrawler | ||
|
||
# MongoDB | ||
MONGODB_HOST=mongodb | ||
MONGODB_PORT=27017 | ||
MONGODB_DB=knightcrawler | ||
MONGO_INITDB_ROOT_USERNAME=mongo | ||
MONGO_INITDB_ROOT_PASSWORD=mongo | ||
|
||
# Addon | ||
DEBUG_MODE=false | ||
|
||
# Consumer | ||
RABBIT_URI=amqp://guest:guest@rabbitmq:5672/?heartbeat=30 | ||
QUEUE_NAME=ingested | ||
JOB_CONCURRENCY=5 | ||
JOBS_ENABLED=true | ||
MAX_SINGLE_TORRENT_CONNECTIONS=10 | ||
TORRENT_TIMEOUT=30000 | ||
UDP_TRACKERS_ENABLED=true | ||
|
||
# Producer | ||
RabbitMqConfiguration__Host=rabbitmq | ||
RabbitMqConfiguration__QueueName=ingested | ||
RabbitMqConfiguration__Username=guest | ||
RabbitMqConfiguration__Password=guest | ||
RabbitMqConfiguration__Durable=true | ||
RabbitMqConfiguration__MaxQueueSize=0 | ||
RabbitMqConfiguration__MaxPublishBatchSize=500 | ||
RabbitMqConfiguration__PublishIntervalInSeconds=10 | ||
GithubSettings__PAT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export const cacheConfig = { | ||
MONGODB_HOST: process.env.MONGODB_HOST || 'mongodb', | ||
MONGODB_PORT: process.env.MONGODB_PORT || '27017', | ||
MONGODB_DB: process.env.MONGODB_DB || 'selfhostio', | ||
MONGO_INITDB_ROOT_USERNAME: process.env.MONGO_INITDB_ROOT_USERNAME || 'mongo', | ||
MONGO_INITDB_ROOT_PASSWORD: process.env.MONGO_INITDB_ROOT_PASSWORD || 'mongo', | ||
COLLECTION_NAME: process.env.MONGODB_COLLECTION || 'selfhostio_consumer_collection', | ||
NO_CACHE: parseBool(process.env.NO_CACHE, false), | ||
} | ||
|
||
// Combine the environment variables into a connection string | ||
// The combined string will look something like: | ||
// 'mongodb://mongo:mongo@localhost:27017/selfhostio?authSource=admin' | ||
cacheConfig.MONGO_URI = 'mongodb://' + cacheConfig.MONGO_INITDB_ROOT_USERNAME + ':' + cacheConfig.MONGO_INITDB_ROOT_PASSWORD + '@' + cacheConfig.MONGODB_HOST + ':' + cacheConfig.MONGODB_PORT + '/' + cacheConfig.MONGODB_DB + '?authSource=admin'; | ||
|
||
export const databaseConfig = { | ||
POSTGRES_HOST: process.env.POSTGRES_HOST || 'postgres', | ||
POSTGRES_PORT: process.env.POSTGRES_PORT || '5432', | ||
POSTGRES_DATABASE: process.env.POSTGRES_DATABASE || 'selfhostio', | ||
POSTGRES_USERNAME: process.env.POSTGRES_USERNAME || 'postgres', | ||
POSTGRES_PASSWORD: process.env.POSTGRES_PASSWORD || 'postgres', | ||
} | ||
|
||
// Combine the environment variables into a connection string | ||
// The combined string will look something like: | ||
// 'postgres://postgres:postgres@localhost:5432/selfhostio' | ||
databaseConfig.POSTGRES_URI = 'postgres://' + databaseConfig.POSTGRES_USERNAME + ':' + databaseConfig.POSTGRES_PASSWORD + '@' + databaseConfig.POSTGRES_HOST + ':' + databaseConfig.POSTGRES_PORT + '/' + databaseConfig.POSTGRES_DATABASE; | ||
|
||
|
||
function parseBool(boolString, defaultValue) { | ||
const isString = typeof boolString === 'string' || boolString instanceof String; | ||
|
||
if (!isString) { | ||
return defaultValue; | ||
} | ||
|
||
return boolString.toLowerCase() === 'true' ? true : defaultValue; | ||
} |
Oops, something went wrong.