config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Config   *Configuration
	URL      = URLProd
	URLProd  = "https://anssl.cn/deploy"
	URLLocal = "http://localhost:9000/deploy"
)
View Source
var Version = "dev"

Version is injected by release builds with:

go build -ldflags="-X github.com/https-cert/deploy/internal/config.Version=vX.Y.Z"

Development builds keep "dev" to avoid shipping stale hard-coded versions.

Functions

func Init

func Init(configFile string) error

Init 初始化配置

func PrepareRuntimeDirs added in v0.6.0

func PrepareRuntimeDirs() error

PrepareRuntimeDirs 创建启动和部署需要的本地目录

Types

type Configuration

type Configuration struct {
	Server   *ServerConfig `yaml:"server"`   // Server 服务端连接和本地 HTTP-01 配置
	SSL      *DeployConfig `yaml:"ssl"`      // SSL 本地部署目标配置
	Update   *UpdateConfig `yaml:"update"`   // Update 自更新配置
	Log      *LogConfig    `yaml:"log"`      // Log 日志轮转配置
	Provider []*Provider   `yaml:"provider"` // Provider 云服务提供商配置
}

Configuration 应用配置结构

func GetConfig

func GetConfig() *Configuration

GetConfig 获取配置

type DeployConfig added in v0.5.0

type DeployConfig struct {
	NginxPath     string          `yaml:"nginxPath"`     // Nginx SSL 证书目录
	ApachePath    string          `yaml:"apachePath"`    // Apache SSL 证书目录
	RustFSPath    string          `yaml:"rustFSPath"`    // RustFS TLS 证书目录
	FeiNiuEnabled bool            `yaml:"feiNiuEnabled"` // 飞牛 TLS 证书部署开关
	OnePanel      *OnePanelConfig `yaml:"onePanel"`      // 1Panel 配置
}

DeployConfig 本地证书部署目标配置

type LogConfig added in v0.6.0

type LogConfig struct {
	MaxSizeMB  int `yaml:"maxSizeMB"`  // MaxSizeMB 单个日志文件最大体积,单位 MB
	MaxBackups int `yaml:"maxBackups"` // MaxBackups 最多保留的轮转文件数量
	MaxAgeDays int `yaml:"maxAgeDays"` // MaxAgeDays 轮转文件最长保留天数
}

LogConfig 日志轮转配置

type OnePanelConfig added in v0.5.1

type OnePanelConfig struct {
	URL    string `yaml:"url"`    // 1Panel API 地址
	APIKey string `yaml:"apiKey"` // 1Panel API 密钥
}

OnePanelConfig 1Panel 配置

type Provider

type Provider struct {
	Name   string        `yaml:"name"`   // Name 提供商内部名称
	Remark string        `yaml:"remark"` // Remark 提供商展示备注
	Auth   *ProviderAuth `yaml:"auth"`   // Auth 提供商认证配置
}

Provider 云服务提供商配置

func GetProvider

func GetProvider(name string) *Provider

GetProvider 获取提供商配置

func (*Provider) GetAccessKey added in v0.5.0

func (p *Provider) GetAccessKey() string

GetAccessKey 获取七牛云 AccessKey

func (*Provider) GetAccessKeyId added in v0.5.0

func (p *Provider) GetAccessKeyId() string

GetAccessKeyId 获取阿里云 AccessKeyId

func (*Provider) GetAccessKeySecret added in v0.5.0

func (p *Provider) GetAccessKeySecret() string

GetAccessKeySecret 获取阿里云 AccessKeySecret

func (*Provider) GetAccessSecret added in v0.5.0

func (p *Provider) GetAccessSecret() string

GetAccessSecret 获取七牛云 AccessSecret

func (*Provider) GetESASiteID added in v0.5.5

func (p *Provider) GetESASiteID() string

GetESASiteID 获取阿里云 ESA SiteId

func (*Provider) GetSecretId added in v0.5.0

func (p *Provider) GetSecretId() string

GetSecretId 获取腾讯云 SecretId

func (*Provider) GetSecretKey added in v0.5.0

func (p *Provider) GetSecretKey() string

GetSecretKey 获取腾讯云 SecretKey

type ProviderAuth added in v0.5.0

type ProviderAuth struct {
	// 阿里云认证字段
	AccessKeyId     string `yaml:"accessKeyId,omitempty"`
	AccessKeySecret string `yaml:"accessKeySecret,omitempty"`
	ESASiteID       string `yaml:"esaSiteId,omitempty"`
	// 腾讯云认证字段
	SecretId  string `yaml:"secretId,omitempty"`
	SecretKey string `yaml:"secretKey,omitempty"`
	// 七牛云认证字段
	AccessKey    string `yaml:"accessKey,omitempty"`
	AccessSecret string `yaml:"accessSecret,omitempty"`
}

ProviderAuth 云服务提供商认证字段集合

type ServerConfig

type ServerConfig struct {
	AccessKey string `yaml:"accessKey"` // AccessKey 后端鉴权令牌
	Env       string `yaml:"env"`       // Env 服务环境,空值为生产环境,local 为本地开发环境
	Port      int    `yaml:"port"`      // Port HTTP-01 challenge 服务端口,默认 19000
}

ServerConfig 服务端连接和本地 HTTP-01 challenge 配置

type UpdateConfig

type UpdateConfig struct {
	// 镜像源类型: github, ghproxy, ghproxy2, custom
	Mirror string `yaml:"mirror"`
	// 自定义镜像地址(当 mirror=custom 时使用)
	CustomURL string `yaml:"customUrl"`
	// HTTP 代理地址
	Proxy string `yaml:"proxy"`
}

UpdateConfig 自更新下载源和代理配置

Jump to

Keyboard shortcuts

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