Skip to content

Commit

Permalink
refactor: refine
Browse files Browse the repository at this point in the history
  • Loading branch information
allape committed Feb 11, 2025
1 parent b8db703 commit 2eb4a8a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ./certs:/app/certs
- ./preview:/preview
environment:
GOVIEW_UI_INDEX_HTML: /app/ui/index.html
GOVIEW_UI_FOLDER: /app/ui/
GOVIEW_TRUSTED_CERTS: /app/certs/root.crt
GOVIEW_PREVIEW_FOLDER: /preview
GOVIEW_DATABASE_DSN: "root:Root_123456@(database:3306)/goview?charset=utf8mb4&parseTime=true"
Expand Down
8 changes: 4 additions & 4 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import "github.com/allape/goenv"

const (
trustedCerts = "GOVIEW_TRUSTED_CERTS"
uiIndexHTML = "GOVIEW_UI_INDEX_HTML"
uiFolder = "GOVIEW_UI_FOLDER"
previewFolder = "GOVIEW_PREVIEW_FOLDER"
bindAddr = "GOVIEW_BIND_ADDR"
enbaleCors = "GOVIEW_ENABLE_CORS"
enableCors = "GOVIEW_ENABLE_CORS"
databaseDSN = "GOVIEW_DATABASE_DSN"
)

var (
TrustedCerts = goenv.Getenv(trustedCerts, "")
UIIndexHTML = goenv.Getenv(uiIndexHTML, "./ui/dist/index.html")
UIFolder = goenv.Getenv(uiFolder, "./ui/dist/")
PreviewFolder = goenv.Getenv(previewFolder, "./preview")
BindAddr = goenv.Getenv(bindAddr, ":8080")
EnableCors = goenv.Getenv(enbaleCors, true)
EnableCors = goenv.Getenv(enableCors, true)
DatabaseDSN = goenv.Getenv(databaseDSN, "root:Root_123456@tcp(localhost:3306)/goview?charset=utf8mb4&parseTime=True&loc=Local")
)
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
engine.Use(cors.Default())
}

err = controller.SetupUIController(engine, env.UIIndexHTML)
err = controller.SetupUIController(engine, env.UIFolder)
if err != nil {
l.Error().Fatalf("Failed to setup ui controller: %v", err)
}
Expand Down

0 comments on commit 2eb4a8a

Please sign in to comment.