mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 05:30:06 +05:30
Поддержка env для подключения к внешним контейнерам
This commit is contained in:
parent
9c4930a0be
commit
e05c5f200c
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user