add database env variables

This commit is contained in:
pluja
2023-09-02 20:09:45 +02:00
parent d2e2982e67
commit 308737301e
3 changed files with 16 additions and 3 deletions

View File

@@ -21,6 +21,8 @@ func main() {
uploadDir := flag.String("updir", "/app/uploads", "upload directory")
asrEndpoint := flag.String("asr", "transcription-api:8000", "asr endpoint, i.e. localhost:9888")
dbHost := flag.String("db", "mongo:27017", "database endpoint host, i.e. localhost:27017")
dbUser := flag.String("dbuser", "whishper", "database user")
dbPass := flag.String("dbpass", "whishper", "database password")
translationEndpoint := flag.String("translation", "translate:5000", "translation endpoint, i.e. localhost:5000")
dev := flag.Bool("dev", false, "development mode")
flag.Parse()
@@ -38,6 +40,12 @@ func main() {
if os.Getenv("DB_ENDPOINT") == "" {
os.Setenv("DB_ENDPOINT", *dbHost)
}
if os.Getenv("DB_USER") == "" {
os.Setenv("DB_USER", *dbUser)
}
if os.Getenv("DB_PASS") == "" {
os.Setenv("DB_PASS", *dbPass)
}
// Configure dev mode
if *dev {

View File

@@ -4,12 +4,14 @@ services:
mongo:
image: mongo
restart: always
env_file:
- .env
volumes:
- ./whishper_data/db_data:/data/db
- ./whishper_data/db_data/logs/:/var/log/mongodb/
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-whishper}
MONGO_INITDB_ROOT_PASSWORD: ${DB_PASS:-whishper}
expose:
- 27017
command: ['--logpath', '/var/log/mongodb/mongod.log']

View File

@@ -1,5 +1,8 @@
# Libretranslate Configuration
LT_LOAD_ONLY=es,en,fr
# Whisper Configuration
WHISPER_MODELS=tiny,small
WHISHPER_HOST=localhost:8082
WHISHPER_HOST=localhost:8082
DB_USER=whishper
DB_PASS=whishper