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_PASSWORD=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`.
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"git.agecem.com/agecem/bottin-ag/config"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -52,6 +53,8 @@ func initConfig() {
|
|||
viper.SetConfigName(".bottin-ag")
|
||||
}
|
||||
|
||||
viper.SetEnvPrefix("BOTTINAG")
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
||||
// If a config file is found, read it in.
|
||||
|
|
|
@ -15,6 +15,12 @@ services:
|
|||
- db
|
||||
build: .
|
||||
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:
|
||||
- '3182:3182'
|
||||
volumes:
|
||||
|
@ -27,6 +33,10 @@ services:
|
|||
- api
|
||||
build: .
|
||||
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:
|
||||
- '3183:3183'
|
||||
volumes:
|
||||
|
|
Loading…
Reference in a new issue