Ajouter et documenter configuration par env #13
3 changed files with 17 additions and 0 deletions
|
@ -14,6 +14,10 @@ Remplir .env
|
||||||
BOTTINAG_POSTGRES_DATABASE=bottinag
|
BOTTINAG_POSTGRES_DATABASE=bottinag
|
||||||
BOTTINAG_POSTGRES_PASSWORD=bottinag
|
BOTTINAG_POSTGRES_PASSWORD=bottinag
|
||||||
BOTTINAG_POSTGRES_USER=bottinag
|
BOTTINAG_POSTGRES_USER=bottinag
|
||||||
|
BOTTINAG_API_KEY=bottinag
|
||||||
|
BOTTINAG_BOTTIN_API_KEY=bottin
|
||||||
|
BOTTINAG_WEB_PASSWORD=bottinag
|
||||||
|
BOTTINAG_WEB_USER=bottinag
|
||||||
```
|
```
|
||||||
|
|
||||||
Le reste s'effectue par le `go` toolchain ou `docker-compose`.
|
Le reste s'effectue par le `go` toolchain ou `docker-compose`.
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.agecem.com/agecem/bottin-ag/config"
|
"git.agecem.com/agecem/bottin-ag/config"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -52,6 +53,8 @@ func initConfig() {
|
||||||
viper.SetConfigName(".bottin-ag")
|
viper.SetConfigName(".bottin-ag")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viper.SetEnvPrefix("BOTTINAG")
|
||||||
|
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||||
viper.AutomaticEnv() // read in environment variables that match
|
viper.AutomaticEnv() // read in environment variables that match
|
||||||
|
|
||||||
// If a config file is found, read it in.
|
// If a config file is found, read it in.
|
||||||
|
|
|
@ -15,6 +15,12 @@ services:
|
||||||
- db
|
- db
|
||||||
build: .
|
build: .
|
||||||
image: 'git.agecem.com/agecem/bottin-ag:latest'
|
image: 'git.agecem.com/agecem/bottin-ag:latest'
|
||||||
|
environment:
|
||||||
|
BOTTINAG_API_KEY: "${BOTTINAG_API_KEY}"
|
||||||
|
BOTTINAG_BOTTIN_API_KEY: "${BOTTINAG_BOTTIN_API_KEY}"
|
||||||
|
BOTTINAG_DB_DATABASE: "${BOTTINAG_POSTGRES_DATABASE}"
|
||||||
|
BOTTINAG_DB_PASSWORD: "${BOTTINAG_POSTGRES_PASSWORD}"
|
||||||
|
BOTTINAG_DB_USER: "${BOTTINAG_POSTGRES_USER}"
|
||||||
ports:
|
ports:
|
||||||
- '3182:3182'
|
- '3182:3182'
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -27,6 +33,10 @@ services:
|
||||||
- api
|
- api
|
||||||
build: .
|
build: .
|
||||||
image: 'git.agecem.com/agecem/bottin-ag:latest'
|
image: 'git.agecem.com/agecem/bottin-ag:latest'
|
||||||
|
environment:
|
||||||
|
BOTTINAG_WEB_API_KEY: "${BOTTINAG_API_KEY}"
|
||||||
|
BOTTINAG_WEB_PASSWORD: "${BOTTINAG_WEB_PASSWORD}"
|
||||||
|
BOTTINAG_WEB_USER: "${BOTTINAG_WEB_USER}"
|
||||||
ports:
|
ports:
|
||||||
- '3183:3183'
|
- '3183:3183'
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in a new issue