mirror of
https://github.com/sablierapp/sablier.git
synced 2025-12-30 17:47:26 +01:00
* feat: add blocking refresh frequency The refresh frequency when using the blocking strategy was set to 5 seconds. This is now configurable with a default value of 5 seconds. * fail ci if codecov fail * always upload codecov even if ci fails * remove useless panic * use fork * add -short - revert later * remove short * publish test results
43 lines
1.3 KiB
Go
43 lines
1.3 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"`
|
|
DefaultRefreshFrequency time.Duration `mapstructure:"DEFAULT_REFRESH_FREQUENCY" yaml:"defaultRefreshFrequency" default:"5s"`
|
|
}
|
|
|
|
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,
|
|
DefaultRefreshFrequency: 5 * time.Second,
|
|
}
|
|
}
|