config

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmojiSuccess           = "✅"
	EmojiWarning           = "⚠️"
	EmojiInfo              = "ℹ️"
	EmojiInput             = "🖊️"
	EmojiQuestion          = "❓"
	EmojiImportant         = "🔑"
	EmojiNetwork           = "🌐"
	EmojiContainer         = "🐳"
	EmojiDatabase          = "💾"
	EmojiServer            = "🖥️"
	EmojiDeployment        = "🚀"
	EmojiError             = "❌"
	EmojiSummary           = "📋"
	EmojiConfig            = "📂"
	EmojiApp               = "📱"
	EmojiEnvironment       = "🌍"
	EmojiSecrets           = "🔐"
	EmojiDomain            = "🌐"
	EmojiPort              = "🔌"
	EmojiVersion           = "📅"
	EmojiBuild             = "🔨"
	EmojiLogs              = "📜"
	EmojiFeedback          = "💬"
	EmojiHelp              = "❗"
	EmojiWelcome           = "👋"
	EmojiNextDeploy        = "🚀 NextDeploy"
	EmojiSummaryLine       = "═"
	EmojiSummaryHeader     = "🎉 Configuration Summary"
	EmojiPrompt            = "👉"
	EmojiPromptYes         = "👍"
	EmojiPromptNo          = "👎"
	EmojiPromptInput       = "✏️"
	EmojiPromptSelect      = "🔘"
	EmojiPromptMultiSelect = "📋"
	EmojiPromptPassword    = "🔑"
	EmojiPromptConfirm     = "✔️"
)
View Source
const (
	ConfigPath       = "nextdeploy.yml"
	ConfigFile       = "nextdeploy.yml"
	SampleConfigFile = "sample.nextdeploy.yml"
)

Variables

This section is empty.

Functions

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

func GenerateSampleConfig

func GenerateSampleConfig() error

func GetSampleConfigTemplate added in v0.1.36

func GetSampleConfigTemplate(targetType string) string

func HandleConfigSetup

func HandleConfigSetup(cmd *cobra.Command, reader *bufio.Reader) error

func PromptAppConfig

func PromptAppConfig(reader *bufio.Reader, cfg *NextDeployConfig) error

func PromptRepositoryConfig

func PromptRepositoryConfig(reader *bufio.Reader, cfg *NextDeployConfig) error

func PromptServerlessConfig added in v0.1.67

func PromptServerlessConfig(reader *bufio.Reader, cfg *NextDeployConfig) error

func PromptTargetType added in v0.1.67

func PromptTargetType(reader *bufio.Reader, cfg *NextDeployConfig) error

func PromptVPSConfig added in v0.1.67

func PromptVPSConfig(reader *bufio.Reader, cfg *NextDeployConfig) error

func PromptYesNo

func PromptYesNo(reader *bufio.Reader, question string) bool

func ReadRequiredInput

func ReadRequiredInput(reader *bufio.Reader) (string, error)

func Save

func Save(cfg *NextDeployConfig, path string) error

func SaveConfig

func SaveConfig(path string, cfg *NextDeployConfig) error

func WriteConfig

func WriteConfig(filename string, cfg *NextDeployConfig) error

Types

type Alert added in v0.1.36

type Alert struct {
	Email        string   `yaml:"email,omitempty"`
	SlackWebhook string   `yaml:"slack_webhook,omitempty"`
	NotifyOn     []string `yaml:"notify_on,omitempty"`
}

type AppConfig

type AppConfig struct {
	Name        string         `yaml:"name"`
	Port        int            `yaml:"port"`
	Environment string         `yaml:"environment"`
	Domain      string         `yaml:"domain,omitempty"`
	CDNEnabled  bool           `yaml:"cdn_enabled,omitempty"`
	Secrets     *SecretsConfig `yaml:"secrets,omitempty"`
}

type Backup

type Backup struct {
	Enabled       bool    `yaml:"enabled"`
	Frequency     string  `yaml:"frequency,omitempty"`
	RetentionDays int     `yaml:"retention_days,omitempty"`
	Storage       Storage `yaml:"storage"`
}

type CloudProviderStruct

type CloudProviderStruct struct {
	Name   string `yaml:"name"`
	Region string `yaml:"region"`
	// #nosec G117
	AccessKey string `yaml:"access_key,omitempty"`
	SecretKey string `yaml:"secret_key,omitempty"`
	Profile   string `yaml:"profile,omitempty"` // AWS CLI profile name
}

type Database

type Database struct {
	Type     string `yaml:"type"`
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Username string `yaml:"username"`
	// #nosec G117
	Password        string `yaml:"password"`
	Name            string `yaml:"name"`
	MigrateOnDeploy bool   `yaml:"migrate_on_deploy,omitempty"`
}

func PromptDatabaseConfig

func PromptDatabaseConfig(reader *bufio.Reader) (Database, error)

type DockerBuild

type DockerBuild struct {
	Context    string            `yaml:"context"`
	Dockerfile string            `yaml:"dockerfile"`
	NoCache    bool              `yaml:"noCache"`
	Args       map[string]string `yaml:"args,omitempty"`
}

type DockerConfig

type DockerConfig struct {
	Image          string      `yaml:"image"`
	Registry       string      `yaml:"registry,omitempty"`
	RegistryRegion string      `yaml:"registryregion,omitempty"`
	Build          DockerBuild `yaml:"build"`
	Push           bool        `yaml:"push"`
	Username       string      `yaml:"username,omitempty"`
	// #nosec G117
	Password     string `yaml:"password,omitempty"`
	AlwaysPull   bool   `yaml:"alwaysPull,omitempty"`
	Strategy     string `yaml:"strategy,omitempty"`
	AutoPush     bool   `yaml:"autoPush,omitempty"`
	Platform     string `yaml:"platform,omitempty"`
	NoCache      bool   `yaml:"noCache,omitempty"`
	BuildContext string `yaml:"buildContext,omitempty"`
	Target       string `yaml:"target,omitempty"`
}

type DopplerConfig

type DopplerConfig struct {
	Project string `yaml:"project"`
	Config  string `yaml:"config"`
	Token   string `yaml:"token,omitempty"`
}

type EnvVariable

type EnvVariable struct {
	Name   string `yaml:"name"`
	Value  string `yaml:"value"`
	Secret bool   `yaml:"secret,omitempty"`
}

type Logging

type Logging struct {
	Enabled    bool   `yaml:"enabled"`
	Provider   string `yaml:"provider"`
	StreamLogs bool   `yaml:"stream_logs"`
	LogPath    string `yaml:"log_path"`
}

type Monitoring

type Monitoring struct {
	Enabled         bool   `yaml:"enabled"`
	Type            string `yaml:"type"`
	Endpoint        string `yaml:"endpoint"`
	CPUThreshold    int    `yaml:"cpu_threshold,omitempty"`
	MemoryThreshold int    `yaml:"memory_threshold,omitempty"`
	DiskThreshold   int    `yaml:"disk_threshold,omitempty"`
	Alert           *Alert `yaml:"alert,omitempty"`
}

func PromptMonitoringConfig

func PromptMonitoringConfig(reader *bufio.Reader) (Monitoring, error)

type NextDeployConfig

type NextDeployConfig struct {
	Version       string               `yaml:"version"`
	TargetType    string               `yaml:"target_type"` // e.g., "vps", "serverless"
	App           AppConfig            `yaml:"app"`
	Repository    Repository           `yaml:"repository"`
	Docker        *DockerConfig        `yaml:"docker,omitempty"`
	Serverless    *ServerlessConfig    `yaml:"serverless,omitempty"`
	Database      *Database            `yaml:"database,omitempty"`
	Monitoring    *Monitoring          `yaml:"monitoring,omitempty"`
	Secrets       SecretsConfig        `yaml:"secrets"`
	Logging       Logging              `yaml:"logging,omitempty"`
	Backup        *Backup              `yaml:"backup,omitempty"`
	SSL           *SSL                 `yaml:"ssl,omitempty"`
	Webhook       *WebhookConfig       `yaml:"webhook,omitempty"`
	Environment   []EnvVariable        `yaml:"environment,omitempty"`
	Servers       []ServerConfig       `yaml:"servers,omitempty"`
	SSLConfig     *SSLConfig           `yaml:"ssl_config,omitempty"`
	CloudProvider *CloudProviderStruct `yaml:"CloudProvider,omitempty"`
}

func Load

func Load() (*NextDeployConfig, error)

func LoadConfig

func LoadConfig() (*NextDeployConfig, error)

func PromptForConfig

func PromptForConfig(reader *bufio.Reader) (*NextDeployConfig, error)

func (*NextDeployConfig) ResolveTargetType added in v0.1.111

func (cfg *NextDeployConfig) ResolveTargetType(metaTarget string) string

ResolveTargetType returns the effective target type (vps or serverless) by checking the explicit field, the serverless config block, and an optional metadata fallback.

type Repository

type Repository struct {
	URL           string `yaml:"url"`
	Branch        string `yaml:"branch"`
	AutoDeploy    bool   `yaml:"autoDeploy"`
	WebhookSecret string `yaml:"webhookSecret,omitempty"`
}

type SSL

type SSL struct {
	Enabled     bool     `yaml:"enabled"`
	Provider    string   `yaml:"provider"`
	Domains     []string `yaml:"domains"`
	Email       string   `yaml:"email"`
	Wildcard    bool     `yaml:"wildcard"`
	DNSProvider string   `yaml:"dns_provider"`
	Staging     bool     `yaml:"staging"`
	Force       bool     `yaml:"force"`
	AutoRenew   bool     `yaml:"auto_renew"`
	Domain      string   `yaml:"domain,omitempty"`
}

type SSLConfig

type SSLConfig struct {
	Domain      string `yaml:"domain"`
	Email       string `yaml:"email"`
	Staging     bool   `yaml:"staging"`
	Wildcard    bool   `yaml:"wildcard"`
	DNSProvider string `yaml:"dns_provider"`
	Force       bool   `yaml:"force"`
	SSL         struct {
		Enabled   bool   `yaml:"enabled"`
		Provider  string `yaml:"provider"`
		Email     string `yaml:"email"`
		AutoRenew bool   `yaml:"auto_renew"`
	} `yaml:"ssl"`
}

type SafeConfig

type SafeConfig struct {
	AppName     string `json:"app_name"`
	Domain      string `json:"domain"`
	Port        int    `json:"port"`
	Environment string `json:"environment"`
	TargetType  string `json:"target_type"`
}

type SecretFile

type SecretFile struct {
	Path string `yaml:"path"`
	// #nosec G117
	Secret string `yaml:"secret"`
}

type SecretsConfig

type SecretsConfig struct {
	Provider string         `yaml:"provider"`
	Doppler  *DopplerConfig `yaml:"doppler,omitempty"`
	Vault    *VaultConfig   `yaml:"vault,omitempty"`
	Files    []SecretFile   `yaml:"files,omitempty"`
	Project  string         `yaml:"project,omitempty"`
	Config   string         `yaml:"config,omitempty"`
	// contains filtered or unexported fields
}

type ServerConfig

type ServerConfig struct {
	WebServer *WebServer `yaml:"web_server,omitempty"`
	Name      string     `yaml:"name"`
	Host      string     `yaml:"host"`
	Port      int        `yaml:"port"`
	Username  string     `yaml:"username"`
	// #nosec G117
	Password      string `yaml:"password"`
	KeyPath       string `yaml:"key_path"`
	SSHKey        string `yaml:"ssh_key,omitempty"`
	KeyPassphrase string `yaml:"key_passphrase,omitempty"`
}

type ServerlessConfig

type ServerlessConfig struct {
	Provider     string `yaml:"provider"` // e.g., "aws"
	Region       string `yaml:"region"`
	CloudFrontId string `yaml:"cloudfront_id,omitempty"`
	IAMRole      string `yaml:"iam_role,omitempty"`    // IAM Role ARN for Lambda
	Handler      string `yaml:"handler,omitempty"`     // Lambda handler (defaults to server.handler)
	Runtime      string `yaml:"runtime,omitempty"`     // Lambda runtime (defaults to nodejs20.x)
	MemorySize   int32  `yaml:"memory_size,omitempty"` // Lambda memory size in MB (defaults to 1024)
	Timeout      int32  `yaml:"timeout,omitempty"`     // Lambda timeout in seconds (defaults to 30)
	Profile      string `yaml:"profile,omitempty"`     // AWS CLI profile name
}

type Storage

type Storage struct {
	Type     string `yaml:"type"`
	Endpoint string `yaml:"endpoint,omitempty"`
	Bucket   string `yaml:"bucket"`
	// #nosec G117
	AccessKey string `yaml:"accessKey,omitempty"`
	SecretKey string `yaml:"secretKey,omitempty"`
}

type VaultConfig

type VaultConfig struct {
	Address string `yaml:"address"`
	Token   string `yaml:"token"`
	Path    string `yaml:"path"`
}

type WebServer

type WebServer struct {
	Type          string `yaml:"type"`
	ConfigPath    string `yaml:"config_path,omitempty"`
	SSL_Enabled   bool   `yaml:"ssl_enabled,omitempty"`
	SSL_Cert_Path string `yaml:"ssl_cert_path,omitempty"`
	SSL_Key_Path  string `yaml:"ssl_key_path,omitempty"`
}

type WebhookConfig added in v0.1.36

type WebhookConfig struct {
	OnSuccess []string `yaml:"on_success,omitempty"`
	OnFailure []string `yaml:"on_failure,omitempty"`
}

Jump to

Keyboard shortcuts

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