cmd

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGlueConfig = GlueConfig{
	Database: _dockerDatabaseConfig,
}
View Source
var DefaultJudgeConfig = JudgeConfig{
	Port:                   8080,
	ProblemsDir:            "/njudge_problems",
	Isolate:                true,
	IsolateSandboxRange:    []int{400, 444},
	UpdateStatusLimitEvery: 5 * time.Second,
	Concurrency:            4,
}
View Source
var DefaultTestProblemConfig = TestProblemConfig{
	ProblemDir:   ".",
	Language:     "cpp17",
	SolutionPath: "./sol/solution.cpp",
	Verbose:      false,

	IsolateSandboxRange: []int{10, 99},
	Isolate:             true,
	Concurrency:         4,
}
View Source
var DefaultWebConfig = WebConfig{
	ProblemsDir: "/njudge_problems",
	Config: web.Config{
		Mode:           web.ModeDevelopment,
		Url:            "http://localhost:5555",
		Port:           "5555",
		TimeZone:       "Europe/Budapest",
		CookieSecret:   "svp3r_s3cr3t",
		GoogleAuth:     web.GoogleAuthConfig{},
		Sendgrid:       web.SendgridConfig{},
		SMTP:           web.SMTPConfig{},
		DatabaseConfig: _dockerDatabaseConfig,
	},
}
View Source
var RootCmd = &cobra.Command{
	Use:     "njudge",
	Version: "v0.6.0",
	Long:    "cli tool to manage njudge instance",
}

Functions

func BindEnvs

func BindEnvs(iface interface{}, parts ...string)

func Execute

func Execute()

func NewGlueCmd added in v0.4.0

func NewGlueCmd(v *viper.Viper) *cobra.Command

func NewJudgeCmd added in v0.4.0

func NewJudgeCmd(v *viper.Viper) *cobra.Command

func NewMigrateCommand added in v0.5.0

func NewMigrateCommand(v *viper.Viper) *cobra.Command

func NewTestProblemCmd added in v0.4.0

func NewTestProblemCmd() *cobra.Command

func NewWebCmd added in v0.5.0

func NewWebCmd(v *viper.Viper) *cobra.Command

Types

type GlueConfig added in v0.4.0

type GlueConfig struct {
	Database          web.DatabaseConfig `mapstructure:"db"`
	DiscordWebhookURL string             `mapstructure:"discord_webhook_url" yaml:"discord_webhook_url"`
}

type JudgeConfig added in v0.4.0

type JudgeConfig struct {
	Port        int    `mapstructure:"port" yaml:"port"`
	ProblemsDir string `mapstructure:"problems_dir" yaml:"problems_dir"`

	Isolate             bool  `mapstructure:"isolate" yaml:"isolate"`
	IsolateSandboxRange []int `mapstructure:"isolate_sandbox_range" yaml:"isolate_sandbox_range"`

	UpdateStatusLimitEvery time.Duration `mapstructure:"update_status_limit_every" yaml:"update_status_limit_every"`

	Concurrency       int    `mapstructure:"concurrency" yaml:"concurrency"`
	DiscordWebhookURL string `mapstructure:"discord_webhook_url" yaml:"discord_webhook_url"`
}

type MigrateCmdArgs

type MigrateCmdArgs struct {
	Up           bool
	Down         bool
	Steps        int
	ForceVersion int
}

type ProblemStore added in v0.4.0

type ProblemStore struct {
	// contains filtered or unexported fields
}

func (ProblemStore) GetProblem added in v0.4.0

func (p ProblemStore) GetProblem(s string) (problems.Problem, error)

type TestProblemConfig added in v0.4.0

type TestProblemConfig struct {
	ProblemDir   string
	Language     string
	SolutionPath string
	Verbose      bool

	IsolateSandboxRange []int
	Isolate             bool
	Concurrency         int
}

type WebConfig added in v0.5.0

type WebConfig struct {
	ProblemsDir       string `mapstructure:"problems_dir" yaml:"problems_dir"`
	DiscordWebhookURL string `mapstructure:"discord_webhook_url" yaml:"discord_webhook_url"`

	web.Config `mapstructure:",squash"`
}

type WebhookHandler added in v0.6.0

type WebhookHandler struct {
	// contains filtered or unexported fields
}

func (WebhookHandler) Enabled added in v0.6.0

func (w WebhookHandler) Enabled(ctx context.Context, level slog.Level) bool

func (WebhookHandler) Handle added in v0.6.0

func (w WebhookHandler) Handle(ctx context.Context, record slog.Record) error

func (WebhookHandler) WithAttrs added in v0.6.0

func (w WebhookHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (WebhookHandler) WithGroup added in v0.6.0

func (w WebhookHandler) WithGroup(name string) slog.Handler

Directories

Path Synopsis
Command gotext-update-templates merge translations and generates a catalog.
Command gotext-update-templates merge translations and generates a catalog.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL