From 8c48c0e4ee4220c452411e8f8e9b7bf658965d34 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Fri, 15 Nov 2024 20:14:10 -0500 Subject: [PATCH] refactor(cmd/joj3): load attr in conf module --- cmd/joj3/conf/conf.go | 2 ++ cmd/joj3/main.go | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/joj3/conf/conf.go b/cmd/joj3/conf/conf.go index eaaad3e..98477ac 100644 --- a/cmd/joj3/conf/conf.go +++ b/cmd/joj3/conf/conf.go @@ -14,6 +14,7 @@ import ( "time" "github.com/go-git/go-git/v5" + "github.com/joint-online-judge/JOJ3/cmd/joj3/env" "github.com/joint-online-judge/JOJ3/internal/stage" "github.com/koding/multiconfig" ) @@ -169,6 +170,7 @@ func ParseConfFile(path string) (conf *Conf, err error) { slog.Error("validate stages conf", "error", err) return } + env.Attr.ConfName = conf.Name // TODO: remove the following backward compatibility codes if len(conf.Stage.Stages) == 0 { conf.Stage.SandboxExecServer = conf.SandboxExecServer diff --git a/cmd/joj3/main.go b/cmd/joj3/main.go index 30bea6a..d317a86 100644 --- a/cmd/joj3/main.go +++ b/cmd/joj3/main.go @@ -7,7 +7,6 @@ import ( "os" "github.com/joint-online-judge/JOJ3/cmd/joj3/conf" - "github.com/joint-online-judge/JOJ3/cmd/joj3/env" "github.com/joint-online-judge/JOJ3/cmd/joj3/stage" "github.com/joint-online-judge/JOJ3/cmd/joj3/teapot" internalStage "github.com/joint-online-judge/JOJ3/internal/stage" @@ -87,7 +86,6 @@ func mainImpl() (err error) { return err } slog.Debug("conf loaded", "conf", confObj) - env.Attr.ConfName = confObj.Name if err := setupSlog(confObj.LogPath); err != nil { // after conf is loaded slog.Error("setup slog", "error", err) return err