Documentation ¶
Overview ¶
Package config contains the configuration data structs and flag types used in the command line tool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LogFormatDefault = LogFormatPretty
LogFormatDefault is the default log format. Used in the LogFormat.JSONSchema method.
var LogLevelDefault = LogLevel(zerolog.WarnLevel)
LogLevelDefault is the default log format. Used in the LogLevel.JSONSchema method.
var OutFormatDefault = OutFormatPretty
OutFormatDefault is the default log format. Used in the OutFormat.JSONSchema method.
Functions ¶
func Schema ¶
func Schema(sourceDir string) *jsonschema.Schema
Schema returns the JSON schema for the Config struct.
Supports optionally supplying the source directory path, which can point to the Go module directory, and will then use the comments from the source code as descriptions in the resulting schema.
Types ¶
type Auth ¶
type Auth struct { // Email is your account's login email address. Email string `jsonschema:"oneof_type=string;null" jsonschema_extras:"format=email"` // Password is your account's login password. Password string `jsonschema:"oneof_type=string;null"` // CSRFToken is provided by this program when it fails to // log in due to them detecting login via new device. You then need to // run the program again but with the CSRF (Cross-Site-Request-Forgery) // token and email token. CSRFToken string `yaml:"csrfToken,omitempty" jsonschema:"oneof_type=string;null"` // EmailToken is sent by Personio to your email when it fails to // log in due to them detecting login via new device. You then need to // run the program again but with the CSRF (Cross-Site-Request-Forgery) // token and email token. EmailToken string `yaml:"emailToken,omitempty" jsonschema:"oneof_type=string;null"` }
Auth contains configs for how the program should authenticate with Personio.
type Config ¶
type Config struct { // BaseURL is the URL to your Personio instance. // This can be with or without the trailing slash. // // The program with later append paths like /login/index // and /api/v1/attendances/periods when invoking its HTTP // requests. // // Any query parameters and fragments will get removed. BaseURL string `yaml:"baseUrl" jsonschema:"oneof_type=string;null" jsonschema_extras:"format=uri"` Auth Auth // MinimumPeriodDuration is the duration for which attendance periods that // are shorter than will get skipped when creating or updating attendance. // // The value is a Go duration, which allows values like: // - 30s // - 12m30s // - 2h12m30s MinimumPeriodDuration time.Duration `yaml:"minimumPeriodDuration" jsonschema:"type=string"` // Output is the format of the command line results. // This controls the format of the single command line // result output written to STDOUT. Output OutFormat Log Log }
Config is the full configuration file.
type Log ¶
type Log struct { // Format is the way the program formats its logging line. The // "pretty" option is meant for humans and is colored, while the // "json" option is meant for easier parsing in logging management // systems like for example Kibana or Splunk. Format LogFormat // Level is the severity level to filter logs on, where "trace" // is the lowest logging/severity level, and "panic" is the // highest. The program will only log messages that are equal // severity or higher than this value. You can also set this // to "disabled" to turn of logging. Level LogLevel }
Log contains configs for the command line logging, which compared to the command line output, loggin is written to STDERR and contains small status reports, and is mostly used for debugging.
type LogFormat ¶
type LogFormat string
LogFormat is an enum of different log formats.
Available LogFormat values.
func (LogFormat) JSONSchema ¶
func (LogFormat) JSONSchema() *jsonschema.Schema
JSONSchema returns the custom JSON schema definition for this type.
func (*LogFormat) Set ¶
Set implements pflag.Value.
Used by cobra when setting the new value for a flag.
func (LogFormat) String ¶
String implements fmt.Stringer and pflag.Value.
Used by cobra when showing the default value of a flag.
func (*LogFormat) Type ¶
Type implements pflag.Value.
Used by cobra when rendering the list of flags and their types.
func (*LogFormat) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
Used when parsing YAML config files.
type LogLevel ¶
LogLevel is an enum of different log levels / severities.
This is just a wrapper around the zerolog.Level type, where all the different enum values are defined.
func (LogLevel) JSONSchema ¶
func (LogLevel) JSONSchema() *jsonschema.Schema
JSONSchema returns the custom JSON schema definition for this type.
func (LogLevel) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
Used when printing YAML config files.
func (*LogLevel) Set ¶
Set implements pflag.Value.
Used by cobra when setting the new value for a flag.
func (LogLevel) String ¶
String implements fmt.Stringer and pflag.Value.
Used by cobra when showing the default value of a flag.
func (*LogLevel) Type ¶
Type implements pflag.Value.
Used by cobra when rendering the list of flags and their types.
func (*LogLevel) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
Used when parsing YAML config files.
type OutFormat ¶
type OutFormat string
OutFormat is an enum of different output formats.
const ( OutFormatPretty OutFormat = "pretty" OutFormatJSON OutFormat = "json" OutFormatYAML OutFormat = "yaml" )
Available OutFormat values.
func (OutFormat) JSONSchema ¶
func (OutFormat) JSONSchema() *jsonschema.Schema
JSONSchema returns the custom JSON schema definition for this type.
func (*OutFormat) Set ¶
Set implements pflag.Value.
Used by cobra when setting the new value for a flag.
func (OutFormat) String ¶
String implements fmt.Stringer and pflag.Value.
Used by cobra when showing the default value of a flag.
func (*OutFormat) Type ¶
Type implements pflag.Value.
Used by cobra when rendering the list of flags and their types.
func (*OutFormat) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
Used when parsing YAML config files.