Skip to content

Commit d5a7b04

Browse files
steveiliop56nicotsx
authored andcommitted
feat: add forward auth url to env generation
1 parent ea6a751 commit d5a7b04

File tree

3 files changed

+39
-34
lines changed

3 files changed

+39
-34
lines changed

internal/utils/constants.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package utils
22

33
const (
4-
DefaultNginxPort = "80"
5-
DefaultNginxPortSSL = "443"
6-
DefaultPostgresPort = "5432"
7-
DefaultDomain = "example.com"
8-
DefaultLocalDomain = "tipi.local"
9-
MinimumDockerVersion = 28
4+
DefaultNginxPort = "80"
5+
DefaultNginxPortSSL = "443"
6+
DefaultPostgresPort = "5432"
7+
DefaultDomain = "example.com"
8+
DefaultLocalDomain = "tipi.local"
9+
MinimumDockerVersion = 28
10+
DefaultForwardAuthURL = "http://runtipi:3000/api/auth/traefik"
1011
)

internal/utils/env.go

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,25 +149,26 @@ func GenerateEnvFile(customEnvFile string) error {
149149

150150
// Create new environment map
151151
newEnv := EnvMap{
152-
"INTERNAL_IP": settings.InternalIP,
153-
"ARCHITECTURE": runtime.GOARCH,
154-
"TIPI_VERSION": string(version),
155-
"ROOT_FOLDER_HOST": config.RootFolder,
156-
"NGINX_PORT": RawToString(settings.NginxPort),
157-
"NGINX_PORT_SSL": RawToString(settings.NginxSSLPort),
158-
"RUNTIPI_APP_DATA_PATH": appDataPath,
159-
"POSTGRES_HOST": "runtipi-db",
160-
"POSTGRES_PORT": RawToString(settings.PostgresPort),
161-
"POSTGRES_DBNAME": "tipi",
162-
"POSTGRES_USERNAME": "tipi",
163-
"POSTGRES_PASSWORD": postgresPassword,
164-
"REDIS_HOST": "runtipi-redis",
165-
"REDIS_PASSWORD": redisPassword,
166-
"DOMAIN": settings.Domain,
167-
"LOCAL_DOMAIN": settings.LocalDomain,
168-
"RABBITMQ_HOST": "runtipi-queue",
169-
"RABBITMQ_USERNAME": "tipi",
170-
"RABBITMQ_PASSWORD": rabbitmqPassword,
152+
"INTERNAL_IP": settings.InternalIP,
153+
"ARCHITECTURE": runtime.GOARCH,
154+
"TIPI_VERSION": string(version),
155+
"ROOT_FOLDER_HOST": config.RootFolder,
156+
"NGINX_PORT": RawToString(settings.NginxPort),
157+
"NGINX_PORT_SSL": RawToString(settings.NginxSSLPort),
158+
"RUNTIPI_APP_DATA_PATH": appDataPath,
159+
"POSTGRES_HOST": "runtipi-db",
160+
"POSTGRES_PORT": RawToString(settings.PostgresPort),
161+
"POSTGRES_DBNAME": "tipi",
162+
"POSTGRES_USERNAME": "tipi",
163+
"POSTGRES_PASSWORD": postgresPassword,
164+
"REDIS_HOST": "runtipi-redis",
165+
"REDIS_PASSWORD": redisPassword,
166+
"DOMAIN": settings.Domain,
167+
"LOCAL_DOMAIN": settings.LocalDomain,
168+
"RABBITMQ_HOST": "runtipi-queue",
169+
"RABBITMQ_USERNAME": "tipi",
170+
"RABBITMQ_PASSWORD": rabbitmqPassword,
171+
"RUNTIPI_FORWARD_AUTH_URL": settings.ForwardAuthURL,
171172
}
172173

173174
// Set default values if not present
@@ -189,6 +190,9 @@ func GenerateEnvFile(customEnvFile string) error {
189190
if newEnv["LOCAL_DOMAIN"] == "" {
190191
newEnv["LOCAL_DOMAIN"] = DefaultLocalDomain
191192
}
193+
if newEnv["RUNTIPI_FORWARD_AUTH_URL"] == "" {
194+
newEnv["RUNTIPI_FORWARD_AUTH_URL"] = DefaultForwardAuthURL
195+
}
192196

193197
// Handle custom env file if provided
194198
if customEnvFile != "" {

internal/utils/schemas.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ func RawToString(value json.RawMessage) string {
3030

3131
// SettingsSchema represents the JSON settings file structure
3232
type SettingsSchema struct {
33-
AppDataPath string `json:"appDataPath,omitempty"`
34-
StoragePath string `json:"storagePath,omitempty"`
35-
InternalIP string `json:"internalIp,omitempty"`
36-
NginxPort json.RawMessage `json:"nginxPort"`
37-
NginxSSLPort json.RawMessage `json:"nginxSslPort"`
38-
PostgresPort json.RawMessage `json:"postgresPort"`
39-
Domain string `json:"domain,omitempty"`
40-
LocalDomain string `json:"localDomain,omitempty"`
33+
AppDataPath string `json:"appDataPath,omitempty"`
34+
StoragePath string `json:"storagePath,omitempty"`
35+
InternalIP string `json:"internalIp,omitempty"`
36+
NginxPort json.RawMessage `json:"nginxPort"`
37+
NginxSSLPort json.RawMessage `json:"nginxSslPort"`
38+
PostgresPort json.RawMessage `json:"postgresPort"`
39+
Domain string `json:"domain,omitempty"`
40+
LocalDomain string `json:"localDomain,omitempty"`
41+
ForwardAuthURL string `json:"forwardAuthUrl,omitempty"`
4142
}
42-

0 commit comments

Comments
 (0)