config

package
v0.0.0-...-5b7b456 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Backend struct {
		Type         string     `yaml:"type" example:"redis"` // Type of backend to use (redis, inMemory)
		LoggerConfig zap.Config `yaml:"logger"`
		LogVerbosity int        `yaml:"logVerbosity"`
		Redis        struct {
			// https://github.com/Go-SQL-Driver/MySQL/?tab=readme-ov-file#dsn-data-source-name
			URL            string `` /* 129-byte string literal not displayed */
			MaxJobs        uint   `yaml:"maxJobs" example:"1000"`
			FinishedJobTTL uint   `yaml:"finishedJobTTL" example:"3600"` // Time to live for finished jobs in seconds
		} `yaml:"redis"`
		InMemory struct {
			MaxJobs                 uint   `yaml:"maxJobs" example:"1000"`
			WriteFrequency          int    `yaml:"writeFrequency" example:"300"`
			EnablePersistantStorage bool   `yaml:"enablePersistantStorage"`
			Directory               string `yaml:"directory"`
			Filename                string `yaml:"filename"`
		} `yaml:"inMemory"`
	}
	LoggerConfig zap.Config `yaml:"logger"`
	Jobs         struct {
		// BulkFlushFrequency        int  `yaml:"bulkFlushFrequency"`
		// BulkMaxSize               int  `yaml:"bulkMaxSize"`
		// ChannelBufferSize         int  `yaml:"channelBufferSize"`
		// MaxIteratorsPerStream     int  `yaml:"maxAllowedIteratorsPerStream"`
		// MaxMessagePerGetOperation uint `yaml:"maxMessagePerGetOperation"`
		LogVerbosity   int  `yaml:"logVerbosity"`
		MaxAllowedJobs uint `yaml:"maxAllowedJobs" example:"25"` // Max number of jobs allowed (0 means no limit)
		JsonSchema     struct {
			Enable bool   `yaml:"enable"` // Enable JSON schema validation
			Path   string `yaml:"path"`   // Path to JSON schema file
		} `yaml:"jsonSchema"`
		DefaultVisibilityTimeout uint `json:"defaultVisibilityTimeout"` // Default duration (in seconds) to keep the job hidden from the queue after it is fetched.
		MaxVisibilityTimeout     uint `json:"maxVisibilityTimeout"`     // Maximum duration (in seconds) to keep the job hidden from the queue after it is fetched.
		RetentionPolicy          struct {
			Enable    bool `yaml:"enable"`    // Enable retention policy
			Interval  int  `yaml:"interval"`  // Interval in seconds to check for expired jobs
			MaxJobAge int  `yaml:"maxJobAge"` // The duration to keep the job in the backend after it has been completed
			MaxJobs   int  `yaml:"maxJobs"`   // The maximum number of jobs to keep in the backend after it has been completed
		} `yaml:"retentionPolicy"`
	} `yaml:"jobs"`
	AuditLog struct {
		Enable                 bool `yaml:"enable"`
		EnableLogAccessGranted bool `yaml:"enableLogAccessGranted"`
	}
	WebServer WebServerConfig `yaml:"webserver"`
	Watchdog  WatchdogConfig  `yaml:"watchdog"`
	Consul    ConsulConfig    `yaml:"consul"`
}

func LoadConfig

func LoadConfig(filename string) (*Config, error)

type ConsulConfig

type ConsulConfig struct {
	Enable bool `yaml:"enable"`
	Server struct {
		Address               string `yaml:"address"`               // Consul server address of the service (required)
		Port                  int    `yaml:"port"`                  // Consul server port of the service (required)
		Token                 string `yaml:"token"`                 // Consul token (optional)
		ReplaceExistingChecks bool   `yaml:"replaceExistingChecks"` // Replace existing checks (default: false)

	} `yaml:"server"`
	Service struct {
		ID        string   `yaml:"id"`        // ID of the service (required)
		Name      string   `yaml:"name"`      // Name of the service (required)
		Tags      []string `yaml:"tags"`      // Tags of the service (optional)
		Namespace string   `yaml:"namespace"` // Consul namespace (optional) (enterprise only)
		Partition string   `yaml:"partition"` // Consul partition (optional) (enterprise only)
	} `yaml:"service"`
	HealthCheck struct {
		Enable   bool   `yaml:"enable"`
		CheckId  string `yaml:"checkId"`
		Interval string `yaml:"interval"`
		Timeout  string `yaml:"timeout"`
		URL      string `yaml:"url"`
	} `yaml:"healthCheck"`
}

type WatchdogConfig

type WatchdogConfig struct {
	Enable   bool `yaml:"enable"`   // Enable watchdog
	Interval int  `yaml:"interval"` // Interval in seconds
}

type WebServerConfig

type WebServerConfig struct {
	HTTP struct {
		Enable  bool   `yaml:"enable"`
		Address string `yaml:"address"`
	}
	Logs struct {
		Enable bool `yaml:"enable"`
	}
	Cors struct {
		Enable       bool   `yaml:"enable"`
		AllowOrigins string `yaml:"allowOrigins"`
		AllowHeaders string `yaml:"allowHeaders"`
	}
	Monitor struct {
		Enable bool `yaml:"enable"`
	}
	Metrics struct {
		Enable bool `yaml:"enable"`
	}
	Swagger struct {
		Enable bool `yaml:"enable"`
	}
}

Jump to

Keyboard shortcuts

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