From 7ddf89a859a8ebd23defbe582eb635026cdba790 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 3 Sep 2024 16:42:05 -0400 Subject: [PATCH 1/3] feature(config): add `server.ui.api.tls.skipverify` --- config.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/config.go b/config.go index c611e07..cf521a7 100644 --- a/config.go +++ b/config.go @@ -45,6 +45,9 @@ type Config struct { Key string `yaml:"key"` Port int `yaml:"port"` Protocol string `yaml:"protocol"` + TLS struct { + SkipVerify bool `yaml:"skipverify"` + } `yaml:"tls"` } `yaml:"api"` Host string `yaml:"host"` Password string `yaml:"password"` @@ -367,6 +370,19 @@ func init() { log.Fatal(err) } + // server.ui.api.tls.skipverify + uiCmd.PersistentFlags().Bool( + "server-ui-api-tls-skipverify", + false, + "Skip API server TLS certificate verification", + ) + if err := viper.BindPFlag( + "server.ui.api.tls.skipverify", + uiCmd.PersistentFlags().Lookup("server-ui-api-tls-skipverify"), + ); err != nil { + log.Fatal(err) + } + // server.ui.host uiCmd.PersistentFlags().String( "server-ui-host", From 2b6c631d64b07554f64ead5c6b57b9c46e876202 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 3 Sep 2024 16:42:25 -0400 Subject: [PATCH 2/3] fix(compose): adjust `.env` inject --- docker-compose.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1156be7..4def68e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,9 +3,9 @@ services: db: image: 'docker.io/library/postgres:16' environment: - POSTGRES_DATABASE: "${BOTTIN_SERVER_API_DB_DATABASE}" - POSTGRES_PASSWORD: "${BOTTIN_SERVER_API_DB_PASSWORD}" - POSTGRES_USER: "${BOTTIN_SERVER_API_DB_USER}" + POSTGRES_DATABASE: "${BOTTIN_SERVER_API_DB_DATABASE:-bottin}" + POSTGRES_PASSWORD: "${BOTTIN_SERVER_API_DB_PASSWORD:-bottin}" + POSTGRES_USER: "${BOTTIN_SERVER_API_DB_USER:-bottin}" volumes: - 'db-data:/var/lib/postgresql/data' restart: 'unless-stopped' @@ -15,7 +15,13 @@ services: - db build: . image: 'git.agecem.com/agecem/bottin:latest' - env_file: '.env' + env: + BOTTIN_SERVER_API_DB_DATABASE: "${BOTTIN_SERVER_API_DB_DATABASE:-bottin}" + BOTTIN_SERVER_API_DB_HOST: "${BOTTIN_SERVER_API_DB_HOST:-db}" + BOTTIN_SERVER_API_DB_PASSWORD: "${BOTTIN_SERVER_API_DB_PASSWORD:-bottin}" + BOTTIN_SERVER_API_DB_USER: "${BOTTIN_SERVER_API_DB_USER:-bottin}" + #BOTTIN_SERVER_API_HOST: "${BOTTIN_SERVER_API_HOST:}" + #BOTTIN_SERVER_API_KEY: "${BOTTIN_SERVER_API_KEY ports: - '1312:1312' volumes: @@ -28,7 +34,9 @@ services: - api build: . image: 'git.agecem.com/agecem/bottin:latest' - env_file: '.env' + env: + BOTTIN_WEB_PASSWORD: "${BOTTIN_WEB_PASSWORD:-bottin}" + BOTTIN_WEB_USER: "${BOTTIN_WEB_USER:-bottin}" ports: - '2312:2312' volumes: From 9072f7114ac46551484ab74b79e2a82238b01605 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 3 Sep 2024 16:43:22 -0400 Subject: [PATCH 3/3] =?UTF-8?q?feature(cmd):=20impl=C3=A9menter=20UI=20API?= =?UTF-8?q?=20TLS=20skip=20verify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd.go b/cmd.go index a54cff6..e801dd3 100644 --- a/cmd.go +++ b/cmd.go @@ -3,6 +3,7 @@ package main import ( "context" "crypto/subtle" + "crypto/tls" "fmt" "html/template" "log" @@ -181,8 +182,15 @@ var uiCmd = &cobra.Command{ } // API Client + var httpClient = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: cfg.Server.UI.API.TLS.SkipVerify, + }, + }, + } apiClient := APIClient{voki.New( - http.DefaultClient, + httpClient, cfg.Server.UI.API.Host, cfg.Server.UI.API.Key, cfg.Server.UI.API.Port,