From 7f9f88650d22254dee9a840f208aa568f7a7bf19 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Fri, 12 Nov 2021 11:43:02 +0330 Subject: added a dev and deployment docker-compose --- hived.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'hived.go') diff --git a/hived.go b/hived.go index 7924206..5345e70 100644 --- a/hived.go +++ b/hived.go @@ -44,6 +44,7 @@ const ( TELEGRAM_BOT_TOKEN_ENV_VAR = "TELEGRAM_BOT_TOKEN" CHANGELLY_API_KEY_ENV_VAR = "CHANGELLY_API_KEY" CHANGELLY_API_SECRET_ENV_VAR = "CHANGELLY_API_SECRET" + SERVER_DEPLOYMENT_TYPE = "SERVER_DEPLOYMENT_TYPE" ) func runTgBot() { @@ -628,7 +629,15 @@ func startServer(gracefulWait time.Duration) { r.HandleFunc("/crypto/robots.txt", robotsHandler) go func() { - if err := srv.ListenAndServeTLS("/certs/fullchain1.pem", "/certs/privkey1.pem"); err != nil { + var certPath, keyPath string + if os.Getenv(SERVER_DEPLOYMENT_TYPE) == "deployment" { + certPath = "/certs/fullchain1.pem" + keyPath = "/certs/privkey1.pem" + } else { + certPath = "/certs/server.cert" + keyPath = "/certs/server.key" + } + if err := srv.ListenAndServeTLS(certPath, keyPath); err != nil { log.Fatal().Err(err) } }() -- cgit v1.2.3