Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env reference: https://www.alexedwards.net/blog/organising-database-access
func NewEnv ¶
func NewEnv(serverConfig *config.ServerConfig, argo *argocd.Argo, metrics *prometheus.Metrics, updater *argocd.ArgoStatusUpdater) (*Env, error)
NewEnv initializes a new Env instance. This function is used to set up the environment for the application's main operation, including setting configurations, initializing Argo service, and metrics.
func (*Env) CreateRouter ¶
CreateRouter initialize router.
func (*Env) ReleaseDeployLock ¶
ReleaseDeployLock godoc @Summary Release deploy lock @Description Release deploy lock @Tags frontend @Success 200 {string} string @Router /api/v1/deploy-lock [delete]
func (*Env) SetDeployLock ¶
SetDeployLock godoc @Summary Set deploy lock @Description Set deploy lock @Tags frontend @Success 200 {string} string @Router /api/v1/deploy-lock [post]
func (*Env) Shutdown ¶
func (env *Env) Shutdown()
Shutdown gracefully shuts down the server and all WebSocket connections. This method is safe to call multiple times. It blocks until all WebSocket goroutines have finished or the shutdown timeout is reached. If the timeout is reached, some goroutines may still be running but should exit shortly as they observe the closed shutdownCh. Any long-running WebSocket writes are bounded by their own 5-second timeout in checkConnection.
type Lockdown ¶
type Lockdown struct {
ManualLock bool // used to manually lock the system
OverrideMode bool // used to temporarily disable scheduled lockdowns
Schedules []LockdownSchedule
// contains filtered or unexported fields
}
func NewLockdown ¶
NewLockdown initializes a new Lockdown structure and parses the lockdown schedules if provided. If the schedule parsing is successful, it returns the new Lockdown. Otherwise, it returns an error.
func (*Lockdown) IsLocked ¶
IsLocked checks if the system is under lockdown. It returns true if either a manual lock is active or if the current time falls within a scheduled lockdown and no override mode is active. Otherwise, it returns false.
func (*Lockdown) Parse ¶
Parse parses the lockdown schedules from a string and stores them in the Lockdown struct.
func (*Lockdown) ReleaseLock ¶
func (l *Lockdown) ReleaseLock()
ReleaseLock cancels the manual lockdown. If a scheduled lockdown is active, it temporarily overrides it for the next 15 minutes. After that period, if the scheduled lockdown is still in progress, the system re-locks.
type LockdownSchedule ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(serverConfig *config.ServerConfig, reg prometheus.Registerer) (*Server, error)
NewServer creates a new server instance with the given configuration and prometheus registerer.