Skip to content

Commit

Permalink
Do not use embedded pg for discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
endline committed Dec 13, 2024
1 parent e237959 commit ad7fc80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 0 additions & 2 deletions cmd/audiusd/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ source_env_file "$OVERRIDE_ENV_FILE"
# Set database name based on creatorNodeEndpoint
if [ -n "$creatorNodeEndpoint" ]; then
POSTGRES_DB="audius_creator_node"
elif [ -n "$audius_discprov_url" ]; then
POSTGRES_DB="audius_discovery"
else
POSTGRES_DB="audiusd"
fi
Expand Down
23 changes: 12 additions & 11 deletions cmd/audiusd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ func main() {
}

func startEchoProxyWithOptionalTLS(hostUrl *url.URL, enableTLS bool) error {

httpPort := os.Getenv("AUDIUSD_HTTP_PORT")
if httpPort == "" {
httpPort = "80"
}

httpsPort := os.Getenv("AUDIUSD_HTTPS_PORT")
if httpsPort == "" {
httpsPort = "443"
}

e := echo.New()

e.Use(middleware.Logger())
Expand Down Expand Up @@ -171,16 +182,6 @@ func startEchoProxyWithOptionalTLS(hostUrl *url.URL, enableTLS bool) error {
e.AutoTLSManager.Cache = autocert.DirCache(getEnvString("audius_core_root_dir", "/audius-core") + "/echo/cache")
e.Pre(middleware.HTTPSRedirect())

httpsPort := os.Getenv("AUDIUSD_HTTPS_PORT")
if httpsPort == "" {
httpsPort = "443"
}

httpPort := os.Getenv("AUDIUSD_HTTP_PORT")
if httpPort == "" {
httpPort = "80"
}

go func() {
if err := e.StartAutoTLS(":" + httpsPort); err != nil && err != http.ErrServerClosed {
e.Logger.Fatal("shutting down the server")
Expand All @@ -196,7 +197,7 @@ func startEchoProxyWithOptionalTLS(hostUrl *url.URL, enableTLS bool) error {
return nil
}

return e.Start(":80")
return e.Start(":" + httpPort)
}

func getEnv[T any](key string, defaultVal T, parse func(string) (T, error)) T {
Expand Down

0 comments on commit ad7fc80

Please sign in to comment.