feat: ETC support and notifications tests
- Add ETC to the list of supported coins. A new `coin` setting can be configured to avoid conflict with `eth`. Mind the lowercase. By default, flexassitant will try to deduce the coin from the miner's address (with eth by default, not etc). (#5) - Add `test` (true/false) to `notifications` section to test notifications with random values fetched from the Flexpool API - Fix typo in the configuration example (#6) BREAKING CHANGE: `notification-templates` configuration settings have been renamed to `notifications`, with sections to configure balance, payment, block and offline workers notifications, with `template` and `test` settings. Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
b519770922
commit
d2d1503779
8 changed files with 289 additions and 53 deletions
33
config.go
33
config.go
|
@ -8,13 +8,13 @@ import (
|
|||
|
||||
// Config to receive settings from the configuration file
|
||||
type Config struct {
|
||||
DatabaseFile string `yaml:"database-file"`
|
||||
MaxBlocks int `yaml:"max-blocks"`
|
||||
MaxPayments int `yaml:"max-payments"`
|
||||
Pools []PoolConfig `yaml:"pools"`
|
||||
Miners []MinerConfig `yaml:"miners"`
|
||||
TelegramConfig TelegramConfig `yaml:"telegram"`
|
||||
NotificationTemplates NotificationTemplatesConfig `yaml:"notification-templates"`
|
||||
DatabaseFile string `yaml:"database-file"`
|
||||
MaxBlocks int `yaml:"max-blocks"`
|
||||
MaxPayments int `yaml:"max-payments"`
|
||||
Pools []PoolConfig `yaml:"pools"`
|
||||
Miners []MinerConfig `yaml:"miners"`
|
||||
TelegramConfig TelegramConfig `yaml:"telegram"`
|
||||
Notifications NotificationsConfig `yaml:"notifications"`
|
||||
}
|
||||
|
||||
// PoolConfig to store Pool configuration
|
||||
|
@ -27,6 +27,7 @@ type PoolConfig struct {
|
|||
// MinerConfig to store Miner configuration
|
||||
type MinerConfig struct {
|
||||
Address string `yaml:"address"`
|
||||
Coin string `yaml:"coin"`
|
||||
EnableBalance bool `yaml:"enable-balance"`
|
||||
EnablePayments bool `yaml:"enable-payments"`
|
||||
EnableOfflineWorkers bool `yaml:"enable-offline-workers"`
|
||||
|
@ -39,12 +40,18 @@ type TelegramConfig struct {
|
|||
ChannelName string `yaml:"channel-name"`
|
||||
}
|
||||
|
||||
// NotificationTemplatesConfig to store notifications templates configuration
|
||||
type NotificationTemplatesConfig struct {
|
||||
Balance string `yaml:"balance"`
|
||||
Payment string `yaml:"payment"`
|
||||
Block string `yaml:"block"`
|
||||
OfflineWorker string `yaml:"offline-worker"`
|
||||
// NotificationTemplatesConfig to store all notifications configurations
|
||||
type NotificationsConfig struct {
|
||||
Balance NotificationConfig `yaml:"balance"`
|
||||
Payment NotificationConfig `yaml:"payment"`
|
||||
Block NotificationConfig `yaml:"block"`
|
||||
OfflineWorker NotificationConfig `yaml:"offline-worker"`
|
||||
}
|
||||
|
||||
// NotificationConfig to store a single notification configuration
|
||||
type NotificationConfig struct {
|
||||
Template string `yaml:"template"`
|
||||
Test bool `yaml:"test"`
|
||||
}
|
||||
|
||||
// NewConfig creates a Config with default values
|
||||
|
|
Reference in a new issue