aboutsummaryrefslogtreecommitdiffstats
path: root/hived.go
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-11-12 08:13:02 +0000
committerterminaldweller <thabogre@gmail.com>2021-11-12 08:13:02 +0000
commit7f9f88650d22254dee9a840f208aa568f7a7bf19 (patch)
tree961e0366375c4c4dbb1d26c0be35be94d020ff87 /hived.go
parentchanges endpoints to crypto/ (diff)
downloadhived-7f9f88650d22254dee9a840f208aa568f7a7bf19.tar.gz
hived-7f9f88650d22254dee9a840f208aa568f7a7bf19.zip
added a dev and deployment docker-compose
Diffstat (limited to 'hived.go')
-rw-r--r--hived.go11
1 files changed, 10 insertions, 1 deletions
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)
}
}()