Compare commits

..

No commits in common. "2a3ccb71df70fe986c7995fd418a644dd0a9d18d" and "31c310960ff478823500fb2b101a275657270477" have entirely different histories.

7 changed files with 9 additions and 10 deletions

View File

@ -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"
)
@ -164,7 +165,7 @@ func parseConventionalCommit(commit string) (*ConventionalCommit, error) {
return cc, nil
}
func ParseConfFile(path string) (conf *Conf, name string, err error) {
func ParseConfFile(path string) (conf *Conf, err error) {
conf = new(Conf)
d := &multiconfig.DefaultLoader{}
d.Loader = multiconfig.MultiLoader(
@ -180,7 +181,7 @@ func ParseConfFile(path string) (conf *Conf, name string, err error) {
slog.Error("validate stages conf", "error", err)
return
}
name = conf.Name
env.Attr.ConfName = conf.Name
// TODO: remove the following backward compatibility codes
if conf.MaxTotalScore < 0 && conf.Teapot.MaxTotalScore >= 0 {
conf.MaxTotalScore = conf.Teapot.MaxTotalScore

View File

@ -7,8 +7,8 @@ import (
"log/slog"
"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/internal/conf"
)
var runningTest bool

View File

@ -6,10 +6,9 @@ import (
"log/slog"
"os"
"github.com/joint-online-judge/JOJ3/cmd/joj3/env"
"github.com/joint-online-judge/JOJ3/cmd/joj3/conf"
"github.com/joint-online-judge/JOJ3/cmd/joj3/stage"
"github.com/joint-online-judge/JOJ3/cmd/joj3/teapot"
"github.com/joint-online-judge/JOJ3/internal/conf"
internalStage "github.com/joint-online-judge/JOJ3/internal/stage"
)
@ -86,12 +85,11 @@ func mainImpl() (err error) {
return err
}
slog.Info("try to load conf", "path", confPath)
confObj, confName, err := conf.ParseConfFile(confPath)
confObj, err = conf.ParseConfFile(confPath)
if err != nil {
slog.Error("parse conf", "error", err)
return err
}
env.Attr.ConfName = confName
slog.Debug("conf loaded", "conf", confObj)
if err := setupSlog(confObj); err != nil { // after conf is loaded
slog.Error("setup slog", "error", err)

View File

@ -5,8 +5,8 @@ import (
"log/slog"
"strings"
"github.com/joint-online-judge/JOJ3/cmd/joj3/conf"
"github.com/joint-online-judge/JOJ3/cmd/joj3/teapot"
"github.com/joint-online-judge/JOJ3/internal/conf"
executors "github.com/joint-online-judge/JOJ3/internal/executor"
_ "github.com/joint-online-judge/JOJ3/internal/parser"
"github.com/joint-online-judge/JOJ3/internal/stage"

View File

@ -7,8 +7,8 @@ import (
"os"
"strings"
"github.com/joint-online-judge/JOJ3/cmd/joj3/conf"
"github.com/joint-online-judge/JOJ3/cmd/joj3/env"
"github.com/joint-online-judge/JOJ3/internal/conf"
)
type CheckResult struct {

View File

@ -8,8 +8,8 @@ import (
"strconv"
"strings"
"github.com/joint-online-judge/JOJ3/cmd/joj3/conf"
"github.com/joint-online-judge/JOJ3/cmd/joj3/env"
"github.com/joint-online-judge/JOJ3/internal/conf"
)
type RunResult struct {