mirror of
https://github.com/bolkedebruin/rdpgw.git
synced 2026-03-31 07:56:35 +00:00
Move to more flexibility in image
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/knadh/koanf/providers/file"
|
"github.com/knadh/koanf/providers/file"
|
||||||
"github.com/knadh/koanf/v2"
|
"github.com/knadh/koanf/v2"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -152,8 +153,12 @@ func Load(configFile string) Configuration {
|
|||||||
"Caps.TokenAuth": true,
|
"Caps.TokenAuth": true,
|
||||||
}, "."), nil)
|
}, "."), nil)
|
||||||
|
|
||||||
if err := k.Load(file.Provider(configFile), yaml.Parser()); err != nil {
|
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
||||||
log.Fatalf("Error loading config from file: %v", err)
|
log.Printf("Config file %s not found, using defaults and environment", configFile)
|
||||||
|
} else {
|
||||||
|
if err := k.Load(file.Provider(configFile), yaml.Parser()); err != nil {
|
||||||
|
log.Fatalf("Error loading config from file: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := k.Load(env.ProviderWithValue("RDPGW_", ".", func(s string, v string) (string, interface{}) {
|
if err := k.Load(env.ProviderWithValue("RDPGW_", ".", func(s string, v string) (string, interface{}) {
|
||||||
@@ -161,7 +166,7 @@ func Load(configFile string) Configuration {
|
|||||||
key = ToCamel(key)
|
key = ToCamel(key)
|
||||||
return key, v
|
return key, v
|
||||||
}), nil); err != nil {
|
}), nil); err != nil {
|
||||||
log.Fatalf("Error loading config from file: %v", err)
|
log.Fatalf("Error loading config from environment: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
koanfTag := koanf.UnmarshalConf{Tag: "koanf"}
|
koanfTag := koanf.UnmarshalConf{Tag: "koanf"}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ COPY --chown=1001 run.sh run.sh
|
|||||||
COPY --chown=1001 --from=builder /opt/rdpgw /opt/rdpgw
|
COPY --chown=1001 --from=builder /opt/rdpgw /opt/rdpgw
|
||||||
COPY --chown=1001 --from=builder /etc/passwd /etc/passwd
|
COPY --chown=1001 --from=builder /etc/passwd /etc/passwd
|
||||||
COPY --chown=1001 --from=builder /etc/ssl/certs /etc/ssl/certs
|
COPY --chown=1001 --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||||
COPY --chown=1001 rdpgw.yaml /opt/rdpgw/rdpgw.yaml
|
#COPY --chown=1001 rdpgw.yaml /opt/rdpgw/rdpgw.yaml
|
||||||
|
|
||||||
WORKDIR /opt/rdpgw
|
WORKDIR /opt/rdpgw
|
||||||
ENTRYPOINT ["/bin/sh", "/run.sh"]
|
ENTRYPOINT ["/bin/sh", "/run.sh"]
|
||||||
|
|||||||
Reference in New Issue
Block a user