feat: update Docker configuration and environment handling #10
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# Build stage
|
# Build stage
|
||||||
FROM golang:1.22-alpine AS builder
|
FROM golang:1.26.1-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
+19
-1
@@ -1,13 +1,31 @@
|
|||||||
version: "3.9"
|
version: "3.9"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:16
|
||||||
|
container_name: velox-postgres
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: velox
|
||||||
|
POSTGRES_PASSWORD: velox_pwd
|
||||||
|
POSTGRES_DB: velox
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- velox_pgdata:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U velox -d velox"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
bot:
|
bot:
|
||||||
build: .
|
build: .
|
||||||
container_name: velox-bot
|
container_name: velox-bot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: postgres://velox:velox_pwd@db:5432/velox?sslmode=disable
|
DB_HOST: ${DB_HOST:-postgres://velox:velox_pwd@db:5432/velox?sslmode=disable}
|
||||||
LAVALINK_HOST: ${LAVALINK_HOST:-ws://lavalink:2333}
|
LAVALINK_HOST: ${LAVALINK_HOST:-ws://lavalink:2333}
|
||||||
LAVALINK_PASSWORD: ${LAVALINK_PASSWORD:-youshallnotpass}
|
LAVALINK_PASSWORD: ${LAVALINK_PASSWORD:-youshallnotpass}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -18,9 +18,8 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadConfig() (*Config, error) {
|
func LoadConfig() (*Config, error) {
|
||||||
if err := godotenv.Load(); err != nil {
|
// Load .env if present (e.g. local dev). Ignore if missing (e.g. Docker injects env vars).
|
||||||
return nil, err
|
_ = godotenv.Load()
|
||||||
}
|
|
||||||
|
|
||||||
token := os.Getenv("BOT_TOKEN")
|
token := os.Getenv("BOT_TOKEN")
|
||||||
if token == "" {
|
if token == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user