qa: Make new parameters modifiable through env

This commit is contained in:
nemunaire 2023-11-25 18:37:35 +01:00
parent 1f833d39fc
commit f3cdf1afca
2 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import (
"io" "io"
"net/http" "net/http"
"net/url" "net/url"
"os"
"path" "path"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@ -14,7 +15,7 @@ import (
var adminLink string var adminLink string
func init() { func init() {
flag.StringVar(&adminLink, "admin-link", adminLink, "URL to admin interface, to use its features as replacement") flag.StringVar(&adminLink, "admin-link", os.Getenv("FIC_QA_ADMIN_LINK"), "URL to admin interface, to use its features as replacement")
} }
func fwdAdmin(method, urlpath string, body io.Reader, out interface{}) error { func fwdAdmin(method, urlpath string, body io.Reader, out interface{}) error {

View File

@ -12,6 +12,7 @@ import (
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
"os"
"path" "path"
"strings" "strings"
"time" "time"
@ -33,10 +34,14 @@ var (
) )
func init() { func init() {
if v, ok := os.LookupEnv("FIC_OIDC_REDIRECT"); ok {
oidcRedirectURL = v
}
flag.StringVar(&oidcRedirectURL, "oidc-redirect", oidcRedirectURL, "Base URL for the redirect after connection") flag.StringVar(&oidcRedirectURL, "oidc-redirect", oidcRedirectURL, "Base URL for the redirect after connection")
flag.StringVar(&gitlabBaseURL, "gitlab-baseurl", gitlabBaseURL, "Base URL of the Gitlab instance") flag.StringVar(&gitlabBaseURL, "gitlab-baseurl", gitlabBaseURL, "Base URL of the Gitlab instance")
flag.StringVar(&gitlabClientID, "gitlab-clientid", gitlabClientID, "ClientID for GitLab's OIDC") flag.StringVar(&gitlabClientID, "gitlab-clientid", os.Getenv("FIC_GITLAB_CLIENT_ID"), "ClientID for GitLab's OIDC")
flag.StringVar(&gitlabSecret, "gitlab-secret", gitlabSecret, "Secret for GitLab's OIDC") flag.StringVar(&gitlabSecret, "gitlab-secret", os.Getenv("FIC_GITLAB_CLIENT_SECRET"), "Secret for GitLab's OIDC")
} }
func InitializeGitLabOIDC(baseURL string) { func InitializeGitLabOIDC(baseURL string) {