Documentation
¶
Overview ¶
Package config resolves the drive server's settings. Flags win over env, and env wins over <ConfigDir>/drive-server.yaml.
Index ¶
Constants ¶
const ( DefaultListen = ":8080" DefaultDataDir = "/data" DefaultConfigDir = "/config" DefaultMaxDocumentSize = 5 << 20 ConfigFileName = "drive-server.yaml" )
Variables ¶
This section is empty.
Functions ¶
func IsLoopback ¶
IsLoopback reports whether host is localhost or a loopback address.
Types ¶
type Config ¶
type Config struct {
BaseURL string
Listen string
DataDir string
ConfigDir string
MaxDocumentSize Size
SMTP SMTP
DevLogMail bool
TrustedProxies []string
UserPolicies []Policy
}
type Flags ¶
type Flags struct {
BaseURL string
Listen string
DataDir string
ConfigDir string
MaxDocumentSize string
TrustedProxies string
DevLogMail bool
}
Flags holds the command-line values. An empty string or false means the flag was not set.
type Policy ¶
type Policy struct {
Name string `yaml:"name"`
Matches []string `yaml:"matches"`
// SignUp defaults to true when nil.
SignUp *bool `yaml:"sign_up"`
Quotas Quotas `yaml:"quotas"`
}
Policy admits the emails its Matches globs match. The first policy that matches an email applies.
func (Policy) SignUpAllowed ¶
SignUpAllowed reports whether an email that matches the policy may create its account by signing in.
type Size ¶
Size is a byte count, or no limit at all. The zero value is "unset": it is what a missing key decodes to, so Validate can tell it from a real limit.
func (*Size) UnmarshalText ¶
UnmarshalText accepts "unlimited" or a positive number with an optional unit: decimal (KB, MB, GB, TB) or binary (KiB, MiB, GiB, TiB). Zero and negative values are errors so that no limit is ever implied.