Add default value for 'DATABASE' env var
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Luca 2023-01-14 03:22:30 +01:00
parent c5b4499b79
commit d5d8c41a17
2 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,6 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
ALLOWED_ROOMS: ALLOWED_ROOMS:
DATABASE: /data/db.sqlite3
DEVICE_NAME: $HOSTNAME DEVICE_NAME: $HOSTNAME
HOMESERVER: 'https://matrix.org' HOMESERVER: 'https://matrix.org'
PASSWORD: PASSWORD:

View File

@ -20,7 +20,6 @@ const (
) )
func FromEnv() Config { func FromEnv() Config {
db := requireEnv("DATABASE")
deviceName := requireEnv("DEVICE_NAME") deviceName := requireEnv("DEVICE_NAME")
homeserver := requireEnv("HOMESERVER") homeserver := requireEnv("HOMESERVER")
userId := requireEnv("USER_ID") userId := requireEnv("USER_ID")
@ -29,6 +28,11 @@ func FromEnv() Config {
allowedRooms := os.Getenv("ALLOWED_ROOMS") allowedRooms := os.Getenv("ALLOWED_ROOMS")
db := os.Getenv("DATABASE")
if db == "" {
db = "/data/db.sqlite3"
}
greeting := os.Getenv("GREETING") greeting := os.Getenv("GREETING")
if greeting == "" { if greeting == "" {
greeting = defaultGreeting greeting = defaultGreeting