mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 13:40:11 +05:30
Поддержка env для подключения к внешним контейнерам
This commit is contained in:
parent
9c4930a0be
commit
e05c5f200c
@ -2,7 +2,7 @@ version: '2'
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build: .
|
build: .
|
||||||
image: registry.gitlab.com/elyby/skinsystem:latest
|
image: registry.ely.by/elyby/skinsystem:latest
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: registry.gitlab.com/elyby/skinsystem:latest
|
image: registry.ely.by/elyby/skinsystem:latest
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
links:
|
links:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
@ -16,17 +17,20 @@ import (
|
|||||||
"elyby/minecraft-skinsystem/lib/worker"
|
"elyby/minecraft-skinsystem/lib/worker"
|
||||||
)
|
)
|
||||||
|
|
||||||
const redisString string = "redis:6379"
|
|
||||||
const redisPoolSize int = 10
|
const redisPoolSize int = 10
|
||||||
|
|
||||||
const rabbitmqString string = "amqp://ely-skinsystem-app:ely-skinsystem-app-password@rabbitmq:5672/%2fely"
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.Println("Starting...")
|
log.Println("Starting...")
|
||||||
|
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
||||||
log.Println("Connecting to redis")
|
log.Println("Connecting to redis")
|
||||||
|
|
||||||
|
var redisString = os.Getenv("REDIS_ADDR")
|
||||||
|
if (redisString == "") {
|
||||||
|
redisString = "redis:6379"
|
||||||
|
}
|
||||||
|
|
||||||
redisPool, redisErr := pool.New("tcp", redisString, redisPoolSize)
|
redisPool, redisErr := pool.New("tcp", redisString, redisPoolSize)
|
||||||
if (redisErr != nil) {
|
if (redisErr != nil) {
|
||||||
log.Fatal("Redis unavailable")
|
log.Fatal("Redis unavailable")
|
||||||
@ -35,6 +39,12 @@ func main() {
|
|||||||
|
|
||||||
log.Println("Connecting to rabbitmq")
|
log.Println("Connecting to rabbitmq")
|
||||||
// TODO: 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)
|
rabbitConnection, rabbitmqErr := amqp.Dial(rabbitmqString)
|
||||||
if (rabbitmqErr != nil) {
|
if (rabbitmqErr != nil) {
|
||||||
log.Fatalf("%s", rabbitmqErr)
|
log.Fatalf("%s", rabbitmqErr)
|
||||||
|
Loading…
Reference in New Issue
Block a user