config

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides typed configuration management for the GitOps agent, using environment variables as the source of truth.

Index

Constants

View Source
const (
	// StatusSuccess represents a successfully completed deployment.
	StatusSuccess = "success"
	// StatusFailed represents a deployment that encountered an error.
	StatusFailed = "failed"
	// StatusRollback represents a state where the system was reverted to a previous version.
	StatusRollback = "rollback"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// RepoURL is the URL of the remote Git repository to monitor.
	RepoURL string
	// Interval defines how often the agent checks for new commits.
	Interval time.Duration
	// LocalPath is the directory where the repository is cloned for analysis.
	LocalPath string

	// DBPath is the file path to the SQLite deployment history database.
	DBPath string

	// DiscordWebhookURL is the endpoint for sending deployment alerts.
	DiscordWebhookURL string

	// WebhookPort is the HTTP port for the inbound webhook server.
	WebhookPort string
	// WebhookSecret is the HMAC key for validating GitHub webhook payloads.
	WebhookSecret string

	// SSHHost is the target machine address for deployments.
	SSHHost string
	// SSHUser is the username for the SSH connection.
	SSHUser string
	// SSHKeyPath is the absolute path to the private SSH key.
	SSHKeyPath string
	// SSHCommands is a list of commands to execute on a successful commit detection.
	SSHCommands []string
	// RollbackCommand is the command executed if the primary deployment fails.
	RollbackCommand string
}

Config defines the configuration structure for the GitOps agent. It includes settings for Git, SSH, notifications, and storage.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig retrieves configuration from environment variables or applies default values. It returns a pointer to Config or an error if validation fails.

func (*Config) Validate

func (c *Config) Validate() error

Validate ensures that the Config structure contains all required fields and valid values before starting the services.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL