diff options
author | terminaldweller <thabogre@gmail.com> | 2021-11-12 08:13:02 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-11-12 08:13:02 +0000 |
commit | 7f9f88650d22254dee9a840f208aa568f7a7bf19 (patch) | |
tree | 961e0366375c4c4dbb1d26c0be35be94d020ff87 /hived.go | |
parent | changes endpoints to crypto/ (diff) | |
download | hived-7f9f88650d22254dee9a840f208aa568f7a7bf19.tar.gz hived-7f9f88650d22254dee9a840f208aa568f7a7bf19.zip |
added a dev and deployment docker-compose
Diffstat (limited to 'hived.go')
-rw-r--r-- | hived.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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) } }() |