4 Commits

Author SHA1 Message Date
0e66267d39 main.go aktualisiert
All checks were successful
release-tag / release-image (push) Successful in 2m17s
build-binaries / build (, amd64, linux) (push) Successful in 49s
build-binaries / build (, arm, 7, linux) (push) Successful in 46s
build-binaries / build (, arm64, linux) (push) Successful in 46s
build-binaries / build (.exe, amd64, windows) (push) Successful in 47s
build-binaries / release (push) Successful in 19s
2025-10-15 11:09:59 +00:00
7a88b0c407 main.go aktualisiert
Some checks failed
release-tag / release-image (push) Has been cancelled
build-binaries / build (, amd64, linux) (push) Successful in 46s
build-binaries / build (, arm, 7, linux) (push) Successful in 44s
build-binaries / build (, arm64, linux) (push) Successful in 45s
build-binaries / build (.exe, amd64, windows) (push) Successful in 47s
build-binaries / release (push) Successful in 18s
2025-10-15 08:34:09 +00:00
ac786f6eab Dockerfile aktualisiert
Some checks failed
release-tag / release-image (push) Has been cancelled
build-binaries / build (, amd64, linux) (push) Has been cancelled
build-binaries / build (, arm, 7, linux) (push) Has been cancelled
build-binaries / build (, arm64, linux) (push) Has been cancelled
build-binaries / build (.exe, amd64, windows) (push) Has been cancelled
build-binaries / release (push) Has been cancelled
2025-10-15 08:33:40 +00:00
d65f53d00f Dockerfile aktualisiert
Some checks failed
build-binaries / build (, amd64, linux) (push) Has been cancelled
build-binaries / build (, arm, 7, linux) (push) Has been cancelled
build-binaries / build (, arm64, linux) (push) Has been cancelled
build-binaries / build (.exe, amd64, windows) (push) Has been cancelled
release-tag / release-image (push) Has been cancelled
build-binaries / release (push) Has been cancelled
2025-10-15 08:33:20 +00:00
2 changed files with 8 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ COPY *.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /goprg RUN CGO_ENABLED=0 GOOS=linux go build -o /goprg
RUN mkdir /data RUN mkdir /data
COPY services.json /data/services.json COPY services.json /data/services.json
##COPY services.json /services.json
VOLUME ["/data"] VOLUME ["/data"]
EXPOSE 8080 EXPOSE 8080
CMD ["/goprg"] CMD ["/goprg"]

19
main.go
View File

@@ -190,7 +190,7 @@ func envOr(k, def string) string {
func main() { func main() {
addr := envOr("addr", ":8080") addr := envOr("addr", ":8080")
cfgPath := envOr("config", ".\services.json") cfgPath := envOr("config", "./services.json")
state := newState() state := newState()
@@ -318,17 +318,12 @@ func writeJSON(w http.ResponseWriter, v any) {
_ = enc.Encode(v) _ = enc.Encode(v)
} }
func readConfig(path string) (*Config, error) { func readConfig(p string) (*Config, error) {
var cfg Config b, err := os.ReadFile(p)
f, err := http.Dir(".").Open(path) // schlichtes Lesen aus CWD if err != nil { return nil, err }
if err != nil { var cfg Config
return nil, err if err := json.Unmarshal(b, &cfg); err != nil { return nil, err }
} return &cfg, nil
defer f.Close()
if err := json.NewDecoder(f).Decode(&cfg); err != nil {
return nil, err
}
return &cfg, nil
} }
var buildTime = time.Now() var buildTime = time.Now()