Documentation
¶
Index ¶
Constants ¶
View Source
const ( AppName string = "notify-server" AppConfigFileName = AppName + ".json" // DefaultMaxRetries HTTP 요청 실패 시 최대 재시도 횟수 기본값 DefaultMaxRetries = 3 // DefaultRetryDelay 재시도 사이의 대기 시간 기본값 DefaultRetryDelay = "2s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
Debug bool `json:"debug"`
HTTPRetry HTTPRetryConfig `json:"http_retry"`
Notifiers NotifierConfig `json:"notifiers"`
Tasks []TaskConfig `json:"tasks"`
NotifyAPI NotifyAPIConfig `json:"notify_api"`
}
Convert JSON to Go struct : https://mholt.github.io/json-to-go/
func InitAppConfig ¶
func InitAppConfigWithFile ¶
InitAppConfigWithFile 지정된 파일에서 설정을 로드합니다. 이 함수는 테스트에서 사용할 수 있도록 파일명을 인자로 받습니다.
type ApplicationConfig ¶
type ApplicationConfig struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
DefaultNotifierID string `json:"default_notifier_id"`
AppKey string `json:"app_key"`
}
ApplicationConfig 애플리케이션 설정 구조체
type HTTPRetryConfig ¶
type HTTPRetryConfig struct {
MaxRetries int `json:"max_retries"`
RetryDelay string `json:"retry_delay"`
}
HTTPRetryConfig HTTP 재시도 설정 구조체
type NotifierConfig ¶
type NotifierConfig struct {
DefaultNotifierID string `json:"default_notifier_id"`
Telegrams []TelegramConfig `json:"telegrams"`
}
NotifierConfig 알림 설정 구조체
func (*NotifierConfig) Validate ¶
func (c *NotifierConfig) Validate() ([]string, error)
Validate NotifierConfig의 유효성을 검사합니다. 유효한 NotifierID 목록을 반환합니다.
type NotifyAPIConfig ¶
type NotifyAPIConfig struct {
WS WSConfig `json:"ws"`
Applications []ApplicationConfig `json:"applications"`
}
NotifyAPIConfig 알림 API 설정 구조체
func (*NotifyAPIConfig) Validate ¶
func (c *NotifyAPIConfig) Validate(notifierIDs []string) error
Validate NotifyAPIConfig의 유효성을 검사합니다.
type TaskCommandConfig ¶
type TaskCommandConfig struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Scheduler struct {
Runnable bool `json:"runnable"`
TimeSpec string `json:"time_spec"`
} `json:"scheduler"`
Notifier struct {
Usable bool `json:"usable"`
} `json:"notifier"`
DefaultNotifierID string `json:"default_notifier_id"`
Data map[string]interface{} `json:"data"`
}
type TaskConfig ¶
type TaskConfig struct {
ID string `json:"id"`
Title string `json:"title"`
Commands []TaskCommandConfig `json:"commands"`
Data map[string]interface{} `json:"data"`
}
type TelegramConfig ¶
type TelegramConfig struct {
ID string `json:"id"`
BotToken string `json:"bot_token"`
ChatID int64 `json:"chat_id"`
}
TelegramConfig 텔레그램 알림 설정 구조체
Click to show internal directories.
Click to hide internal directories.