config

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package config defines the program's configuration including the defaults

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvFile = ".env"
)

Functions

func InitConfig

func InitConfig(file string, config *AppConfig) error

InitConfig initializes the configuration and sets the defaults

Types

type AppConfig

type AppConfig struct {
	Server struct {
		Host                 string `envconfig:"SERVER_HOST"`
		Port                 string `envconfig:"SERVER_PORT" default:"8080"`
		TlsPort              string `envconfig:"SERVER_TLS_PORT" default:"8443"`
		GracefulShutdownTime int    `envconfig:"GRACEFUL_SHUTDOWN_TIME" default:"10"`
		UseTls               bool   `envconfig:"USE_TLS" default:"false"`
		CertFile             string `envconfig:"CERT_FILE" default:"./cert/cert.pem"`
		KeyFile              string `envconfig:"KEY_FILE" default:"./cert/cert.key"`
	}
	Gin struct {
		Mode         string `envconfig:"GIN_MODE" default:"release"`
		TemplatePath string `envconfig:"TEMPLATE_PATH" default:"./templates/"`
		LogToLogger  bool   `envconfig:"LOG_TO_LOGGER" default:"false"`
	}
	Misc struct {
		TestCrawl    bool   `envconfig:"TEST_CRAWL" default:"false"`
		TestDate     string `envconfig:"TEST_DATE" default:"2024/01/15"`
		FileSaveFile string `envconfig:"FILE_SAVE_FILE" default:"files.dta"`
	}
	Crawl struct {
		RootFolder              string         `envconfig:"ROOT_FOLDER" default:"Z:\\sendungen"`
		CrawlExtensions         []string       `envconfig:"CRAWL_EXTENSIONS" default:".mp3,.m4a,.wav,.stream"`
		AudioFileExtensions     []string       `envconfig:"AUDIO_FILE_EXTENSIONS" default:".mp3,.m4a,.wav"`
		StreamingFileExtensions []string       `envconfig:"STREAM_FILE_EXTENSIONS" default:".stream"`
		FfprobePath             string         `envconfig:"FFPROBE_PATH" default:"/usr/bin/ffprobe"`
		FfProbeTimeOut          int            `envconfig:"FFPROBE_TIMEOUT" default:"60"`
		CrawlCycleMin           int            `envconfig:"CRAWL_CYCLE_MIN" default:"15"`
		StreamMap               map[string]int `envconfig:"STREAM_MAP"`
		GenerateHash            bool           `envconfig:"GENERATE_HASH" default:"false"`
	}
	Export struct {
		ExportFolder           string  `envconfig:"EXPORT_FOLDER" default:"C:\\TEMP"`
		ShortDeltaAllowance    float64 `envconfig:"SHORT_DELTA_ALLOWANCE" default:"5.0"`
		LongDeltaAllowance     float64 `envconfig:"LONG_DELTA_ALLOWANCE" default:"8.0"`
		MairListUrl            string  `envconfig:"MAIRLIST_URL" default:"http://localhost:9300/"`
		MairListUser           string  `envconfig:"MAIRLIST_USER" default:"dbtest"`
		MairListPassword       string  `envconfig:"MAIRLIST_PASS" default:"dbtest"`
		AppendPlaylist         bool    `envconfig:"APPEND_PLAYLIST" default:"false"`
		TerminateAfterDuration bool    `envconfig:"TERM_AFTER_DUR" default:"true"`
		LimitTime              bool    `envconfig:"LIMIT_TIME" default:"false"`
	}
	CalCms struct {
		QueryCalCms     bool     `envconfig:"QUERY_CALCMS" default:"false"`
		CmsUrl          string   `envconfig:"CALCMS_URL" default:"https://programm.coloradio.org/agenda/events.cgi"`
		Template        string   `envconfig:"CALCMS_TEMPLATE" default:"event.json-p"`
		EventExclusion  []string `envconfig:"EVENT_EXCLUSION"`
		ExportDayEvents bool     `envconfig:"EXPORT_DAY_EVENTS" default:"false"`
	}
	RunTime struct {
		Router               *gin.Engine
		BgJobs               *cron.Cron
		ListenAddr           string
		StartDate            time.Time
		CrawlRunNumber       int
		LastCrawlDate        time.Time
		FilesInList          int
		AudioFilesInList     int
		StreamFilesInList    int
		LastExportRunDate    time.Time
		LastExportedFileDate time.Time
		LastExportFileName   string
		CrawlRunning         bool
		ExportRunning        bool
		CleanRunning         bool
		LastCleanDate        time.Time
		FilesCleaned         int
		CrawlJobId           int
		ExportJobId          int
		CleanJobId           int
		EventJobId           int
		LastCalCmsState      string
		LastMairListState    string
	}
}

Configuration with subsections

Jump to

Keyboard shortcuts

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