Archived
1

Refactoring: now we respect gofmt and have some comments

This commit is contained in:
2017-10-18 09:39:50 +04:00
parent 6f374e560e
commit 8dab6c0699
47 changed files with 607 additions and 479 deletions

View File

@@ -12,8 +12,9 @@ import (
"gopkg.in/yaml.v2"
)
const VERSION = "0.29"
const VERSION = "0.295"
// DatabaseConnection handles database connection settings in config.yaml
type DatabaseConnection struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
@@ -22,15 +23,18 @@ type DatabaseConnection struct {
Database string `yaml:"database"`
}
// TelegramConnection handles settings for Telegram connection in config.yaml
type TelegramConnection struct {
APIToken string `yaml:"api_token"`
}
// Config is a struct which represents config.yaml structure
type Config struct {
Telegram TelegramConnection `yaml:"telegram_connection"`
Database DatabaseConnection `yaml:"database_connection"`
}
// Init is a configuration initializer
func (c *Config) Init() {
fname, _ := filepath.Abs("./config.yml")
yamlFile, yerr := ioutil.ReadFile(fname)
@@ -44,6 +48,7 @@ func (c *Config) Init() {
}
}
// New creates new empty Config object
func New() *Config {
c := &Config{}
return c