From 4a5cff20cd7c9dc72722b8bf5f0b3dc57f1268f6 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 12 Feb 2024 15:13:09 +0100 Subject: [PATCH] app/config: Adding description to methods. --- app/config/cli.go | 1 + app/config/config.go | 1 + app/config/file.go | 1 + app/config/yaml.go | 1 + 4 files changed, 4 insertions(+) diff --git a/app/config/cli.go b/app/config/cli.go index 1ff3b2b..8fa44bc 100644 --- a/app/config/cli.go +++ b/app/config/cli.go @@ -6,6 +6,7 @@ import ( "github.com/urfave/cli/v2" ) +// Read cli flag values into the config func (cfg *Config) ReadCliFlags(ctx *cli.Context) error { logFile := ctx.Path("log") if len(logFile) > 0 { diff --git a/app/config/config.go b/app/config/config.go index 091edd9..1e71e33 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -43,6 +43,7 @@ type Config struct { Telegram TelegramConfig `yaml:"telegram"` } +// Create a new Config object with default values func New() Config { return Config{ MessageCodec: "json", diff --git a/app/config/file.go b/app/config/file.go index b1b4863..d47444e 100644 --- a/app/config/file.go +++ b/app/config/file.go @@ -4,6 +4,7 @@ import ( "os" ) +// Read values from file func (cfg *Config) ReadFile(filename string) error { bytes, err := os.ReadFile(filename) if err != nil { diff --git a/app/config/yaml.go b/app/config/yaml.go index b1d7db8..60a2097 100644 --- a/app/config/yaml.go +++ b/app/config/yaml.go @@ -20,6 +20,7 @@ func (ship *ShipConfig) UnmarshalYAML(value *yaml.Node) error { return err } +// Read YAML config data func (cfg *Config) ReadYAML(data []byte) error { return yaml.Unmarshal(data, cfg) }