feat: accept host variable
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
|
||||
PORT=3001
|
||||
HOST="127.0.0.1"
|
||||
|
||||
DATABASE_URL="postgres://<user>:<user>@<host>:<port>/<db>?sslmode=disable"
|
||||
|
||||
ADMIN_NAME="admin"
|
||||
|
@ -32,12 +32,17 @@ func main() {
|
||||
|
||||
user.EnsureAdminUser(ctx, repo)
|
||||
|
||||
host := os.Getenv("HOST")
|
||||
if host == "" {
|
||||
host = "0.0.0.0"
|
||||
}
|
||||
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "3000"
|
||||
}
|
||||
|
||||
server := api.NewAPIServer(fmt.Sprintf(":%s", port), repo)
|
||||
server := api.NewAPIServer(fmt.Sprintf("127.0.0.1:%s", port), repo)
|
||||
if err := server.Run(); err != nil {
|
||||
log.Fatalln("ERR: Failed to start server:", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user