libfic: avoid stange MYSQL_HOST variable, expect IP or DN

This commit is contained in:
nemunaire 2019-07-30 17:13:55 +02:00
parent 8131fda0e7
commit 41a3279bf8
3 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,7 @@ services:
depends_on:
- mysql
environment:
- MYSQL_HOST=tcp(mysql:3306)
- MYSQL_HOST=mysql
- FICCA_PASS
fic-backend:
@ -49,7 +49,7 @@ services:
depends_on:
- mysql
environment:
- MYSQL_HOST=tcp(mysql:3306)
- MYSQL_HOST=mysql
fic-frontend:
build:

View File

@ -154,7 +154,7 @@ services:
image: nemunaire/fic-admin:latest
command: ["/srv/admin", "-bind=:8081", "-baseurl=/admin/", "-localimport=/mnt/fic"]
env:
- MYSQL_HOST=tcp(db:3306)
- MYSQL_HOST=db
- FICCA_PASS=jee8AhloAith1aesCeQu5ahgIegaeM4K
binds:
- /etc/hosts:/etc/hosts:ro
@ -179,7 +179,7 @@ services:
- name: fic-backend
image: nemunaire/fic-backend:latest
env:
- MYSQL_HOST=tcp(db:3306)
- MYSQL_HOST=db
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/teams:/srv/TEAMS

View File

@ -19,7 +19,12 @@ func DSNGenerator() string {
db_db := "fic"
if v, exists := os.LookupEnv("MYSQL_HOST"); exists {
db_host = v
db_host = "tcp(" + v + ":"
if p, exists := os.LookupEnv("MYSQL_PORT"); exists {
db_host += p + ")"
} else {
db_host += "3306)"
}
}
if v, exists := os.LookupEnv("MYSQL_PASSWORD"); exists {
db_password = v