flag

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port       int    // chi 监听端口
	Host       string // chi 监听地址
	KubeConfig string // KUBECONFIG文件路径

	Debug             bool   // 调试模式,同步修改所有的debug模式
	LogV              int    // klog的日志级别klog.V(this)
	InCluster         bool   // 是否集群内模式
	LoginType         string // password,oauth,token,.. 登录方式,默认为password
	EnableTempAdmin   bool   // 是否启用临时管理员账户配置
	AdminUserName     string // 管理员用户名,启用临时管理员账户配置后生效
	AdminPassword     string // 管理员密码,启用临时管理员账户配置后生效
	JwtTokenSecret    string // JWT token secret
	NodeShellImage    string // nodeShell 镜像
	KubectlShellImage string // kubectlShell 镜像
	ImagePullTimeout  int    // 镜像拉取超时时间(秒)
	PrintConfig       bool   // 是否打印配置信息
	Version           string // 版本号,由编译时自动注入
	GitCommit         string // git commit, 由编译时自动注入
	GitTag            string // git tag, 由编译时自动注入
	GitRepo           string // git仓库地址, 由编译时自动注入
	BuildDate         string // 编译时间, 由编译时自动注入

	ConnectCluster       bool   // 启动程序后,是否自动连接发现的集群,默认关闭
	ProductName          string // 产品名称,默认为K8M
	ResourceCacheTimeout int    // 资源缓存时间(秒)

	DBDriver   string // 数据库驱动类型: sqlite、mysql、postgresql等
	SqlitePath string // sqlite 数据库路径
	SqliteDSN  string // sqlite 自定义 DSN 参数配置,设置后优先使用

	// MySQL 配置
	MysqlHost      string // mysql 主机
	MysqlPort      int    // mysql 端口
	MysqlUser      string // mysql 用户名
	MysqlPassword  string // mysql 密码
	MysqlDatabase  string // mysql 数据库名
	MysqlCharset   string // mysql 字符集
	MysqlCollation string // mysql 排序规则
	MysqlQuery     string // mysql 额外参数
	MysqlLogMode   bool   // mysql 日志模式
	// PostgreSQL 配置
	PgHost     string // postgres 主机
	PgPort     int    // postgres 端口
	PgUser     string // postgres 用户名
	PgPassword string // postgres 密码
	PgDatabase string // postgres 数据库名
	PgSSLMode  string // postgres sslmode
	PgTimeZone string // postgres 时区
	PgLogMode  bool   // postgres 日志模式
	Think      bool   // AI 是否开启思考过程输出,true 时显示思考过程,建议生产环境开启
	// LDAP配置
	LdapEnabled         bool   // 是否使用SSL连接LDAP服务器
	LdapHost            string // LDAP服务器地址
	LdapPort            string // LDAP服务器端口
	LdapUsername        string // LDAP用户名
	LdapPassword        string // LDAP密码
	LdapBaseDN          string // LDAP基础DN
	LdapBindUserDN      string // LDAP绑定用户DN
	LdapAnonymousQuery  int    // 是否允许匿名查询LDAP
	LdapUserField       string // LDAP用户字段
	LdapLogin2AuthClose bool   // LDAP登录后是否关闭认证

	// Lease 同步参数
	LeaseNamespace            string // Lease 所在命名空间,默认自动检测
	LeaseDurationSeconds      int    // Lease 有效时长(秒),默认60
	LeaseRenewIntervalSeconds int    // Lease 续约间隔(秒),默认20
	HostClusterID             string // 宿主集群ID
}

func Init

func Init() *Config

func (*Config) InitFlags

func (c *Config) InitFlags()

func (*Config) ShowConfigCloseMethod added in v0.0.78

func (c *Config) ShowConfigCloseMethod()

func (*Config) ShowConfigInfo added in v0.0.74

func (c *Config) ShowConfigInfo()

Jump to

Keyboard shortcuts

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