This commit is contained in:
@@ -621,13 +621,17 @@ import (
|
||||
|
||||
func main() {
|
||||
addr := env("ATLAS_HTTP_ADDR", ":8080")
|
||||
dbPath := env("ATLAS_DB_PATH", "data/atlas.db")
|
||||
// Support both ATLAS_DB_PATH (SQLite) and ATLAS_DB_CONN (PostgreSQL connection string)
|
||||
dbConn := env("ATLAS_DB_CONN", "")
|
||||
if dbConn == "" {
|
||||
dbConn = env("ATLAS_DB_PATH", "data/atlas.db")
|
||||
}
|
||||
|
||||
app, err := httpapp.New(httpapp.Config{
|
||||
Addr: addr,
|
||||
TemplatesDir: "web/templates",
|
||||
StaticDir: "web/static",
|
||||
DatabasePath: dbPath,
|
||||
DatabaseConn: dbConn,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("init app: %v", err)
|
||||
@@ -878,6 +882,7 @@ SyslogIdentifier=atlas-api
|
||||
# Environment variables
|
||||
Environment="ATLAS_HTTP_ADDR=$HTTP_ADDR"
|
||||
Environment="ATLAS_DB_PATH=$DB_PATH"
|
||||
Environment="ATLAS_DB_CONN=$DB_PATH"
|
||||
Environment="ATLAS_BACKUP_DIR=$BACKUP_DIR"
|
||||
Environment="ATLAS_LOG_LEVEL=INFO"
|
||||
Environment="ATLAS_LOG_FORMAT=json"
|
||||
@@ -910,8 +915,11 @@ create_config() {
|
||||
# HTTP Server
|
||||
ATLAS_HTTP_ADDR=$HTTP_ADDR
|
||||
|
||||
# Database
|
||||
# Database (SQLite path or PostgreSQL connection string)
|
||||
# For SQLite: ATLAS_DB_PATH=/var/lib/atlas/atlas.db
|
||||
# For PostgreSQL: ATLAS_DB_CONN=postgres://user:pass@host:port/dbname?sslmode=disable
|
||||
ATLAS_DB_PATH=$DB_PATH
|
||||
ATLAS_DB_CONN=
|
||||
|
||||
# Backup Directory
|
||||
ATLAS_BACKUP_DIR=$BACKUP_DIR
|
||||
|
||||
Reference in New Issue
Block a user