gitdeploy/internal/options/options.go

47 lines
1.2 KiB
Go
Raw Permalink Normal View History

2020-09-28 23:39:05 +00:00
package options
import (
"flag"
2021-02-21 11:25:42 +00:00
"time"
2020-09-28 23:39:05 +00:00
)
2021-02-21 11:25:42 +00:00
// Server is an instance of the config
2020-09-28 23:39:05 +00:00
var Server *ServerConfig
2021-02-21 11:25:42 +00:00
// ServerConfig is an options struct
2020-09-28 23:39:05 +00:00
type ServerConfig struct {
2021-03-17 19:10:38 +00:00
Addr string
TrustProxy bool
RepoList string
Compress bool
ServePath string
ScriptsPath string
Promotions []string
LogDir string // where the job logs should go
TmpDir string // where the backlog files go
DebounceDelay time.Duration
DefaultMaxJobTime time.Duration
StaleJobAge time.Duration // how old a dead job is before it's stale
StaleLogAge time.Duration
ExpiredLogAge time.Duration
2021-02-21 11:25:42 +00:00
// TODO use BacklogDir instead?
2020-09-28 23:39:05 +00:00
}
2021-02-21 11:25:42 +00:00
// ServerFlags are the flags the web server can use
2020-09-28 23:39:05 +00:00
var ServerFlags *flag.FlagSet
2021-02-21 11:25:42 +00:00
// InitFlags are the flags for the main binary itself
2020-09-28 23:39:05 +00:00
var InitFlags *flag.FlagSet
2021-02-21 11:25:42 +00:00
// DefaultMaxBodySize is for the web server input
2020-09-28 23:39:05 +00:00
var DefaultMaxBodySize int64 = 1024 * 1024
2021-02-21 11:25:42 +00:00
// TimeFile is a time format like RFC3339, but filename-friendly
const TimeFile = "2006-01-02_15-04-05"
2020-09-28 23:39:05 +00:00
func init() {
Server = &ServerConfig{}
ServerFlags = flag.NewFlagSet("run", flag.ExitOnError)
InitFlags = flag.NewFlagSet("init", flag.ExitOnError)
2020-09-28 23:39:05 +00:00
}