Documentation
¶
Index ¶
Constants ¶
View Source
const ( // AppName 애플리케이션의 전역 고유 식별자입니다. AppName string = "notify-server" // DefaultFilename 애플리케이션 초기화 시 참조하는 기본 설정 파일명입니다. // 실행 인자를 통해 명시적인 경로가 제공되지 않을 경우, 시스템은 이 파일을 탐색하여 구성을 로드합니다. DefaultFilename = AppName + ".json" // DefaultMaxRetries HTTP 요청 실패 시 기본 재시도 횟수입니다. DefaultMaxRetries = 3 // DefaultRetryDelay HTTP 요청 실패 시 기본 재시도 사이의 대기 시간입니다. DefaultRetryDelay = 2 * time.Second // DefaultListenPort 웹 서비스가 수신 대기할 기본 포트입니다. DefaultListenPort = 8080 )
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"`
Notifier NotifierConfig `json:"notifier"`
Tasks []TaskConfig `json:"tasks" validate:"unique=ID"`
NotifyAPI NotifyAPIConfig `json:"notify_api"`
}
AppConfig 애플리케이션의 모든 설정을 포함하는 최상위 구조체
type ApplicationConfig ¶
type ApplicationConfig struct {
ID string `json:"id" validate:"required"`
Title string `json:"title"`
Description string `json:"description"`
DefaultNotifierID string `json:"default_notifier_id" validate:"required"`
AppKey string `json:"app_key" validate:"required"`
}
ApplicationConfig 알림 API를 사용할 수 있는 클라이언트 어플리케이션의 인증 정보를 정의하는 구조체
func (ApplicationConfig) String ¶
func (c ApplicationConfig) String() string
type CORSConfig ¶
type CORSConfig struct {
AllowOrigins []string `json:"allow_origins" validate:"dive,cors_origin"`
}
CORSConfig 웹 브라우저의 교차 출처 리소스 공유(CORS) 정책을 설정하는 구조체
type CommandConfig ¶
type CommandConfig struct {
ID string `json:"id" validate:"required"`
Title string `json:"title"`
Description string `json:"description"`
Scheduler SchedulerConfig `json:"scheduler"`
Notifier CommandNotifierConfig `json:"notifier"`
DefaultNotifierID string `json:"default_notifier_id"`
Data map[string]interface{} `json:"data"`
}
CommandConfig 작업(Task) 내에서 실제로 실행되는 개별 명령을 정의하는 구조체
type CommandNotifierConfig ¶
type CommandNotifierConfig struct {
Usable bool `json:"usable"`
}
CommandNotifierConfig 작업 완료 후 알림 발송 여부를 정의하는 구조체
type HTTPRetryConfig ¶
type HTTPRetryConfig struct {
MaxRetries int `json:"max_retries" validate:"gte=0"`
RetryDelay time.Duration `json:"retry_delay" validate:"gt=0"`
}
HTTPRetryConfig HTTP 요청 실패 시 재시도 횟수와 대기 시간을 정의하는 설정 구조체
type NotifierConfig ¶
type NotifierConfig struct {
DefaultNotifierID string `json:"default_notifier_id" validate:"required"`
Telegrams []TelegramConfig `json:"telegrams" validate:"unique=ID"`
}
NotifierConfig 텔레그램 등 다양한 알림 채널을 정의하는 설정 구조체
func (*NotifierConfig) GetIDs ¶
func (c *NotifierConfig) GetIDs() []string
GetIDs 등록된 모든 알림 채널의 ID 목록을 반환합니다.
type NotifyAPIConfig ¶
type NotifyAPIConfig struct {
WS WSConfig `json:"ws"`
CORS CORSConfig `json:"cors"`
Applications []ApplicationConfig `json:"applications" validate:"unique=ID"`
}
NotifyAPIConfig 알림 발송을 위한 REST API 서버 및 웹소켓 설정 구조체
type SchedulerConfig ¶
SchedulerConfig 작업 스케줄링 설정을 정의하는 구조체
type TaskConfig ¶
type TaskConfig struct {
ID string `json:"id" validate:"required"`
Title string `json:"title"`
Commands []CommandConfig `json:"commands" validate:"required,min=1,unique=ID"`
Data map[string]interface{} `json:"data"`
}
TaskConfig 주기적으로 실행하거나 특정 조건에 따라 수행할 작업을 정의하는 구조체
type TelegramConfig ¶
type TelegramConfig struct {
ID string `json:"id" validate:"required"`
BotToken string `json:"bot_token" validate:"required,telegram_bot_token"`
ChatID int64 `json:"chat_id" validate:"required"`
}
TelegramConfig 텔레그램 봇 토큰 및 채팅 ID 정보를 담는 설정 구조체
func (TelegramConfig) String ¶
func (c TelegramConfig) String() string
type WSConfig ¶
type WSConfig struct {
TLSServer bool `json:"tls_server"`
TLSCertFile string `json:"tls_cert_file" validate:"required_if=TLSServer true,omitempty,file"`
TLSKeyFile string `json:"tls_key_file" validate:"required_if=TLSServer true,omitempty,file"`
ListenPort int `json:"listen_port" validate:"min=1,max=65535"`
}
WSConfig 웹 서비스의 포트 및 TLS(HTTPS) 보안 설정을 정의하는 구조체
Click to show internal directories.
Click to hide internal directories.