From 991cf9a8831e09e5d6e9ae395db1b727da7f4727 Mon Sep 17 00:00:00 2001 From: ngn Date: Fri, 22 Nov 2024 02:24:39 +0300 Subject: [PATCH] cleanup docker setup --- Dockerfile | 3 --- Makefile | 6 ++++++ docker/init.sh | 6 +++--- server/builder/stage.go | 2 ++ server/config/config.go | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile index 98d2cc8..95c20c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,4 @@ RUN chmod +x "init.sh" ENV EZCAT_STATIC_DIR "./static" ENV EZCAT_PAYLOAD_DIR "./payloads" -ARG API_URL -ENV API_URL $API_URL - ENTRYPOINT ["dumb-init", "./init.sh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3324ab4 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +format: + $(MAKE) -C server format + $(MAKE) -C payloads/stage format + cd app && npm run format + +.PHONY: format diff --git a/docker/init.sh b/docker/init.sh index e6b0375..a66bbe9 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -1,9 +1,9 @@ #!/bin/sh # update the API_URL for the frontend APP -if [ ! -z "$API_URL" ]; then - API_URL=$(echo $API_URL | sed 's/\//\\\//g') - find ./static -type f -exec sed -i -e "s/http:\/\/127.0.0.1:5566/$API_URL/g" {} \; +if [ ! -z "$EZCAT_API_URL" ]; then + EZCAT_API_URL=$(echo $EZCAT_API_URL | sed 's/\//\\\//g') + find ./static -type f -exec sed -i -e "s/http:\/\/127.0.0.1:5566/$EZCAT_API_URL/g" {} \; fi # run the server diff --git a/server/builder/stage.go b/server/builder/stage.go index 9ffed72..5c8ae62 100644 --- a/server/builder/stage.go +++ b/server/builder/stage.go @@ -30,6 +30,8 @@ func (s *Struct) buildStage(b *build) (err error) { if s.Config.Debug { options["STAGE_DEBUG"] = "1" + } else { + options["STAGE_DEBUG"] = "0" } if out, err := util.RunBuild(builddir, b.Target.CodeName(), options); err != nil { diff --git a/server/config/config.go b/server/config/config.go index 9dd1490..b882359 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -58,7 +58,7 @@ func (conf *Struct) Load() error { case reflect.String: field_val.SetString(env_val) - case reflect.Uint16: + case reflect.Int: var env_val_int int if env_val_int, err = strconv.Atoi(env_val); err != nil { return fmt.Errorf("%s should be an integer", env_name)