mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-21 13:23:03 +01:00
* refactor: rename providers to Provider * refactor folders * fix build cmd * fix build cmd * fix build cmd * fix cmd start
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package config
|
|
|
|
import "time"
|
|
|
|
type DynamicStrategy struct {
|
|
CustomThemesPath string `mapstructure:"CUSTOM_THEMES_PATH" yaml:"customThemesPath"`
|
|
ShowDetailsByDefault bool `mapstructure:"SHOW_DETAILS_BY_DEFAULT" yaml:"showDetailsByDefault"`
|
|
DefaultTheme string `mapstructure:"DEFAULT_THEME" yaml:"defaultTheme" default:"hacker-terminal"`
|
|
DefaultRefreshFrequency time.Duration `mapstructure:"DEFAULT_REFRESH_FREQUENCY" yaml:"defaultRefreshFrequency" default:"5s"`
|
|
}
|
|
|
|
type BlockingStrategy struct {
|
|
DefaultTimeout time.Duration `mapstructure:"DEFAULT_TIMEOUT" yaml:"defaultTimeout" default:"1m"`
|
|
}
|
|
|
|
type Strategy struct {
|
|
Dynamic DynamicStrategy
|
|
Blocking BlockingStrategy
|
|
}
|
|
|
|
func NewStrategyConfig() Strategy {
|
|
return Strategy{
|
|
Dynamic: newDynamicStrategy(),
|
|
Blocking: newBlockingStrategy(),
|
|
}
|
|
}
|
|
|
|
func newDynamicStrategy() DynamicStrategy {
|
|
return DynamicStrategy{
|
|
DefaultTheme: "hacker-terminal",
|
|
ShowDetailsByDefault: true,
|
|
DefaultRefreshFrequency: 5 * time.Second,
|
|
}
|
|
}
|
|
|
|
func newBlockingStrategy() BlockingStrategy {
|
|
return BlockingStrategy{
|
|
DefaultTimeout: 1 * time.Minute,
|
|
}
|
|
}
|