- Assign default circle to user when leaving a circle

- Support Pushover
- Support Disable Signup
- Migrate chatID to TargetID
This commit is contained in:
Mo Tarbin 2024-12-14 02:15:51 -05:00
parent 850d472445
commit adf5c0c0cd
20 changed files with 362 additions and 151 deletions

View file

@ -9,21 +9,27 @@ import (
)
type Config struct {
Name string `mapstructure:"name" yaml:"name"`
Telegram TelegramConfig `mapstructure:"telegram" yaml:"telegram"`
Database DatabaseConfig `mapstructure:"database" yaml:"database"`
Jwt JwtConfig `mapstructure:"jwt" yaml:"jwt"`
Server ServerConfig `mapstructure:"server" yaml:"server"`
SchedulerJobs SchedulerConfig `mapstructure:"scheduler_jobs" yaml:"scheduler_jobs"`
EmailConfig EmailConfig `mapstructure:"email" yaml:"email"`
StripeConfig StripeConfig `mapstructure:"stripe" yaml:"stripe"`
IsDoneTickDotCom bool `mapstructure:"is_done_tick_dot_com" yaml:"is_done_tick_dot_com"`
Name string `mapstructure:"name" yaml:"name"`
Telegram TelegramConfig `mapstructure:"telegram" yaml:"telegram"`
Pushover PushoverConfig `mapstructure:"pushover" yaml:"pushover"`
Database DatabaseConfig `mapstructure:"database" yaml:"database"`
Jwt JwtConfig `mapstructure:"jwt" yaml:"jwt"`
Server ServerConfig `mapstructure:"server" yaml:"server"`
SchedulerJobs SchedulerConfig `mapstructure:"scheduler_jobs" yaml:"scheduler_jobs"`
EmailConfig EmailConfig `mapstructure:"email" yaml:"email"`
StripeConfig StripeConfig `mapstructure:"stripe" yaml:"stripe"`
IsDoneTickDotCom bool `mapstructure:"is_done_tick_dot_com" yaml:"is_done_tick_dot_com"`
IsUserCreationDisabled bool `mapstructure:"is_user_creation_disabled" yaml:"is_user_creation_disabled"`
}
type TelegramConfig struct {
Token string `mapstructure:"token" yaml:"token"`
}
type PushoverConfig struct {
Token string `mapstructure:"token" yaml:"token"`
}
type DatabaseConfig struct {
Type string `mapstructure:"type" yaml:"type"`
Host string `mapstructure:"host" yaml:"host"`
@ -98,6 +104,13 @@ func configEnvironmentOverrides(Config *Config) {
if os.Getenv("DONETICK_TELEGRAM_TOKEN") != "" {
Config.Telegram.Token = os.Getenv("DONETICK_TELEGRAM_TOKEN")
}
if os.Getenv("DONETICK_PUSHOVER_TOKEN") != "" {
Config.Pushover.Token = os.Getenv("DONETICK_PUSHOVER_TOKEN")
}
if os.Getenv("DONETICK_DISABLE_SIGNUP") == "true" {
Config.IsUserCreationDisabled = true
}
}
func LoadConfig() *Config {
// set the config name based on the environment: