JOJ3/cmd/joj3/conf/model.go
张泊明518370910136 23b348a19c
All checks were successful
build / build (push) Successful in 1m46s
build / trigger-build-image (push) Has been skipped
build / build (pull_request) Successful in 1m40s
build / trigger-build-image (pull_request) Has been skipped
fix: redact sandbox token and enable CI lint
2026-08-02 20:46:52 -07:00

86 lines
1.7 KiB
Go

package conf
import (
"log/slog"
"github.com/joint-online-judge/JOJ3/internal/stage"
)
type ConfStage struct {
Name string
Groups []string
Executor struct {
Name string
With struct {
Default stage.Cmd
Cases []OptionalCmd
}
}
Parsers []struct {
Name string
With any
}
}
type Conf struct {
Name string `default:"unknown"`
LogPath string `default:""`
ActorCsvPath string `default:""`
SandboxExecServer string `default:"localhost:5051"`
SandboxToken string `default:""`
OutputPath string `default:"joj3_result.json"`
PreStages []ConfStage
Stages []ConfStage
PostStages []ConfStage
}
// LogValue preserves the configuration's diagnostic value without writing the
// sandbox credential to text or structured logs.
func (c Conf) LogValue() slog.Value {
type logConf Conf
if c.SandboxToken != "" {
c.SandboxToken = "[REDACTED]"
}
return slog.AnyValue(logConf(c))
}
type OptionalCmd struct {
Args *[]string
Env *[]string
Stdin *stage.CmdFile
Stdout *stage.CmdFile
Stderr *stage.CmdFile
CPULimit *uint64
RealCPULimit *uint64
ClockLimit *uint64
MemoryLimit *uint64
StackLimit *uint64
ProcLimit *uint64
CPURateLimit *uint64
CPUSetLimit *string
CopyIn *map[string]stage.CmdFile
CopyInCached *map[string]string
CopyInDir *string
CopyOut *[]string
CopyOutCached *[]string
CopyOutMax *uint64
CopyOutDir *string
TTY *bool
StrictMemoryLimit *bool
DataSegmentLimit *bool
AddressSpaceLimit *bool
}
type ConventionalCommit struct {
Type string
Scope string
Description string
Group string
Body string
Footer string
}