From e05c5f200cdc4e7ddb01dc068b5f60b1fcbdc145 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Wed, 12 Oct 2016 20:43:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=BA=D0=B0=20env=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=20?= =?UTF-8?q?=D0=B2=D0=BD=D0=B5=D1=88=D0=BD=D0=B8=D0=BC=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=D0=B9=D0=BD=D0=B5=D1=80=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.dev.yml | 2 +- docker-compose.prod.yml | 2 +- minecraft-skinsystem.go | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 7022863..db6d8c0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -2,7 +2,7 @@ version: '2' services: app: build: . - image: registry.gitlab.com/elyby/skinsystem:latest + image: registry.ely.by/elyby/skinsystem:latest ports: - "80:80" volumes: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 30675b6..3c86b31 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,7 +1,7 @@ version: '2' services: app: - image: registry.gitlab.com/elyby/skinsystem:latest + image: registry.ely.by/elyby/skinsystem:latest ports: - "80:80" links: diff --git a/minecraft-skinsystem.go b/minecraft-skinsystem.go index ff89ffa..9f90837 100644 --- a/minecraft-skinsystem.go +++ b/minecraft-skinsystem.go @@ -1,6 +1,7 @@ package main import ( + "os" "log" "runtime" "time" @@ -16,17 +17,20 @@ import ( "elyby/minecraft-skinsystem/lib/worker" ) -const redisString string = "redis:6379" const redisPoolSize int = 10 -const rabbitmqString string = "amqp://ely-skinsystem-app:ely-skinsystem-app-password@rabbitmq:5672/%2fely" - func main() { log.Println("Starting...") runtime.GOMAXPROCS(runtime.NumCPU()) log.Println("Connecting to redis") + + var redisString = os.Getenv("REDIS_ADDR") + if (redisString == "") { + redisString = "redis:6379" + } + redisPool, redisErr := pool.New("tcp", redisString, redisPoolSize) if (redisErr != nil) { log.Fatal("Redis unavailable") @@ -35,6 +39,12 @@ func main() { log.Println("Connecting to rabbitmq") // TODO: rabbitmq становится доступен не сразу. Нужно дождаться, пока он станет доступен, периодически повторяя запросы + + var rabbitmqString = os.Getenv("RABBITMQ_ADDR") + if (rabbitmqString == "") { + rabbitmqString = "amqp://ely-skinsystem-app:ely-skinsystem-app-password@rabbitmq:5672/%2fely" + } + rabbitConnection, rabbitmqErr := amqp.Dial(rabbitmqString) if (rabbitmqErr != nil) { log.Fatalf("%s", rabbitmqErr)