Documentation
¶
Index ¶
- func CreateJsonSchemaForConfig() ([]byte, error)
- func DurationViperHookFunc() mapstructure.DecodeHookFuncType
- func InitConfig() error
- func WriteToml(w io.Writer, j interface{}) error
- type ApiConfig
- type AuthConfig
- type BackupConfig
- type Config
- type Duration
- type Metrics
- type S3BaseConfig
- type S3UploaderConfig
- type TranslatorService
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateJsonSchemaForConfig ¶ added in v0.8.4
func DurationViperHookFunc ¶ added in v0.8.4
func DurationViperHookFunc() mapstructure.DecodeHookFuncType
func InitConfig ¶
func InitConfig() error
Types ¶
type ApiConfig ¶
type ApiConfig struct {
// Address (interface) to listen to
Address string `cfg:"address" default:"0.0.0.0" help:"Address (interface) to listen to)" jsonschema:"default=0.0.0.0"`
RedirectPort int `` /* 135-byte string literal not displayed */
Port int `cfg:"port" default:"80" help:"Port to listen to"`
CertFile string `cfg:"cert-file" default:"" help:"Number of request to make total"`
CertKey string `cfg:"cert-key" default:"" help:"Number of request to make total"`
DBLocation string `cfg:"db-path" default:"./storage/db.bbolt" help:"Filepath to where to store the database"`
// Timeout used for reads
ReadTimeout Duration
// Timeout used for writes
WriteTimeout Duration
// Timeout used for idles
IdleTimeout Duration
// Timeout used for shutdown
ShutdownTimeout Duration
// If set, will register debug-handlers at
// - /debug/vars
// - /debug/vars/
// - /debug/pprof/
// - /debug/pprof/cmdline
// - /debug/pprof/profile
// - /debug/pprof/symbol
// - /debug/pprof/trace
Debug bool
}
type AuthConfig ¶
type AuthConfig struct {
// Defines how long a Session should be valid for.
SessionLifeTime Duration `jsonschema="title=Defines how long a session should be valid for"`
}
type BackupConfig ¶ added in v0.8.4
type BackupConfig struct {
S3 *S3BaseConfig `json:"s3" help:"Use s3 for backup"`
// If no database is available at startup, this source can be used to fetch the database.
// Skiver will then use that as a database.
// This can be useful in environments where there is no readily available persistant storage.
FetchOnStartup bool
// The database can be backed up as often as every write, but can be relaxed with this value.
// Defaults to 10 minutes
MaxInterval Duration `` /* 140-byte string literal not displayed */
// Can be used to set a custom objectkey.
// defaults to "skiver.bbolt"
FileName string
}
type Config ¶
type Config struct {
// Level for logging
// Enum: [trace debug info warn warning error panic]
LogLevel string `` /* 211-byte string literal not displayed */
// Enum: [human json]
LogFormat string `cfg:"log-format" default:"human" help:"Format of the logs. Can be human or json" jsonschema:"enum=human,enum=json"`
Api ApiConfig `cfg:"api" help:"Used with the api-server"`
// If set, will enable a self-check that monitors the applications resource-usage. Used for debugging, and monitoring outside of any orcestrator like kubernetes
SelfCheck bool `cfg:"selv-check" default:"true" help:"Enables a self check to check resources."`
// Global translator-services that should be available
TranslatorServices []TranslatorService
// Options for Authentication
Authentication AuthConfig
// Set to enable gzip-module for all content served
Gzip bool
// Enable Metrics (prometheus-compatible)
Metrics Metrics
// Used to upload files to external targets when creating snapshots.
UploadSnapShots map[string]Uploader
// Used to upload backups of the database.
// Can optionally also be used as a source to retreve a backup from on startup, if there is no database.
DatabaseBackups map[string]BackupConfig `help:"Optional backupendpoints for databases" json:"databaseBackups"`
}
func CreateSampleComfig ¶ added in v0.8.0
func CreateSampleComfig() Config
type Duration ¶ added in v0.8.4
Duration that marshals and unmarshal yaml, toml and json.
func ParseDuration ¶ added in v0.8.4
func (Duration) JSONSchema ¶ added in v0.8.4
func (Duration) JSONSchema() *jsonschema.Schema
func (Duration) MarshalText ¶ added in v0.8.4
func (*Duration) UnmarshalJSON ¶ added in v0.8.4
func (*Duration) UnmarshalText ¶ added in v0.8.4
type S3BaseConfig ¶ added in v0.8.4
type S3BaseConfig struct {
// Endpoint for the s3-compatible service
Endpoint string `json:"endpoint" help:"Endpoint for the s3-compatible service"`
// The region for the service.
Region string `json:"region" help:"The region for the service"`
// Bucket to upload into
BucketID string `json:"bucketID" help:"Bucket to upload into"`
// AccessKeyID for the bucket / application
AccessKey string `json:"accessKey" help:"Accesskey for the bucket / application"`
// Private key or Secret access key for the bucket / application
PrivateKey string
// Name for provider, used for display-puroposes
ProviderName string `json:"providerName" help:"Pretty name, displayed in logs etc."`
// If set, will add headers for use with Browser-TTL, CDN-TTL and CloudFlare-TTL
ForcePathStyle bool `json:"forcePathStyle" help:"If set will add headers for use with Browser-TTL, CDN-TTL and CloudFlare-TTL"`
}
type S3UploaderConfig ¶ added in v0.8.0
type S3UploaderConfig struct {
// S3-compatible target
S3BaseConfig `mapstructure:",squash"`
// Can be used to override the url that is produced.
// Golang-templating is available
// Variables:
// `.Object`: The current Object-id (fileName)
// `.Bucket`: The current Object-id (fileName)
// `.EndpointURL`: net.Url version of the Endpoint
// `.Endpoint`: Endpoint as string
// `.Region`: Region.
UrlFormat string `` /* 345-byte string literal not displayed */
CacheControl string
}
type TranslatorService ¶
TDB
type Uploader ¶ added in v0.8.0
type Uploader struct {
// S3-compatible target
S3 *S3UploaderConfig
}
Click to show internal directories.
Click to hide internal directories.