conf

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package conf 定义配置选项

Index

Constants

This section is empty.

Variables

View Source
var (

	// 域名白名单
	OrgWhiteList map[string]bool
	// legacy redirect paths
	RedirectPathList map[string]bool
)

Functions

func AuditArchiveCron

func AuditArchiveCron() string

AuditArchiveCron 返回审计事件归档周期

func AuditCleanCron

func AuditCleanCron() string

AuditCleanCron 返回审计事件软删除周期

func AuditTemplate

func AuditTemplate() apistructs.AuditTemplateMap

AuditTemplate 返回权限列表

func AvatarStorageURL

func AvatarStorageURL() string

AvatarStorageURL 返回 OSSUsage 选项

func CreateOrgEnabled

func CreateOrgEnabled() bool

func Debug

func Debug() bool

Debug 返回 Debug 选项.

func EnableNS

func EnableNS() bool

EnableNS 是否打开项目级命名空间

func GittarOutterURL

func GittarOutterURL() string

GittarOutterURL 返回 GittarOutterURL 选项.

func LegacyUIDomain

func LegacyUIDomain() string

LegacyUIDomain

func LicenseKey

func LicenseKey() string

LicenseKey 返回 LicenseKey 选项.

func Load

func Load()

Load 加载配置项.

func LoadForTest

func LoadForTest()

LoadForTest unit test

func LocalMode

func LocalMode() bool

LocalMode 本地调试模式

func MySQLDatabase

func MySQLDatabase() string

MySQLDatabase 返回 MySQLDatabase 选项.

func MySQLHost

func MySQLHost() string

MySQLHost 返回 MySQLHost 选项.

func MySQLLoc

func MySQLLoc() string

MySQLLoc 返回 MySQLLoc 选项.

func MySQLPassword

func MySQLPassword() string

MySQLPassword 返回 MySQLPassword 选项.

func MySQLPort

func MySQLPort() string

MySQLPort 返回 MySQLPort 选项.

func MySQLUsername

func MySQLUsername() string

MySQLUsername 返回 MySQLUsername 选项.

func OpenAPIDomain

func OpenAPIDomain() string

OpenAPIDomain 返回 OpenAPIDomain 选项

func OrgAuditDefaultRetentionDays

func OrgAuditDefaultRetentionDays() uint64

func OrgAuditMaxRetentionDays

func OrgAuditMaxRetentionDays() uint64

func OryCompatibleClientID

func OryCompatibleClientID() string

func OryCompatibleClientSecret

func OryCompatibleClientSecret() string

func OryEnabled

func OryEnabled() bool

func OryKratosPrivateAddr

func OryKratosPrivateAddr() string

func Permissions

func Permissions() map[string]model.RolePermission

Permissions 获取权限配置

func ProjectStatsCacheCron

func ProjectStatsCacheCron() string

ProjectStatsCacheCron 项目状态缓存刷新周期

func RedisAddr

func RedisAddr() string

RedisAddr 返回 redis 地址

func RedisMasterName

func RedisMasterName() string

RedisMasterName 返回redis master name

func RedisPwd

func RedisPwd() string

RedisPwd 返回 redis 密码

func RedisSentinelAddrs

func RedisSentinelAddrs() string

RedisSentinelAddrs 返回 redis 哨兵地址

func RolePermissions

func RolePermissions(roles []string) (map[string]model.RolePermission, []model.RolePermission)

RolePermissions 获取角色对应的权限配置

func RootDomain

func RootDomain() string

RootDomain 返回 RootDomain 选项

func RootDomainList

func RootDomainList() []string

Multiple domain

func SubscribeLimitNum

func SubscribeLimitNum() uint64

func SysAuditCleanInterval

func SysAuditCleanInterval() int

SysAuditCleanInterval 返回 sys scope 审计事件软删除周期

func UCClientID

func UCClientID() string

UCClientID 返回 UCClientID 选项.

func UCClientSecret

func UCClientSecret() string

UCClientSecret 返回 UCClientSecret 选项.

func UIDomain

func UIDomain() string

UIDomain 返回 UIDomain 选项

func UIPublicURL

func UIPublicURL() string

UIPublicURL 返回 UIPublicURL 选项

Types

type Conf

type Conf struct {
	LocalMode             bool   `env:"LOCAL_MODE" default:"false"`
	Debug                 bool   `env:"DEBUG" default:"false"`
	MySQLHost             string `env:"MYSQL_HOST"`
	MySQLPort             string `env:"MYSQL_PORT"`
	MySQLUsername         string `env:"MYSQL_USERNAME"`
	MySQLPassword         string `env:"MYSQL_PASSWORD"`
	MySQLDatabase         string `env:"MYSQL_DATABASE"`
	MySQLLoc              string `env:"MYSQL_LOC" default:"Local"`
	GittarOutterURL       string `env:"GITTAR_PUBLIC_URL"`
	UCClientID            string `env:"UC_CLIENT_ID"`
	UCClientSecret        string `env:"UC_CLIENT_SECRET"`
	RootDomain            string `env:"DICE_ROOT_DOMAIN"`
	UIPublicURL           string `env:"UI_PUBLIC_URL"`
	UIDomain              string `env:"UI_PUBLIC_ADDR"`
	OpenAPIDomain         string `env:"OPENAPI_PUBLIC_ADDR"` // Deprecated: after cli refactored
	AvatarStorageURL      string `env:"AVATAR_STORAGE_URL"`  // file:///avatars or oss://appkey:appsecret@endpoint/bucket
	LicenseKey            string `env:"LICENSE_KEY"`
	RedisMasterName       string `default:"my-master" env:"REDIS_MASTER_NAME"`
	RedisSentinelAddrs    string `default:"" env:"REDIS_SENTINELS_ADDR"`
	RedisAddr             string `default:"127.0.0.1:6379" env:"REDIS_ADDR"`
	RedisPwd              string `default:"anywhere" env:"REDIS_PASSWORD"`
	ProjectStatsCacheCron string `env:"PROJECT_STATS_CACHE_CRON" default:"0 0 1 * * ?"`
	EnableProjectNS       bool   `env:"ENABLE_PROJECT_NS" default:"true"`
	LegacyUIDomain        string `env:"LEGACY_UI_PUBLIC_ADDR"`

	// subscribe config
	SubscribeLimitNum uint64 `env:"SUBSCRIBE_LIMIT_NUM" default:"6"`

	// ory/kratos config
	OryEnabled           bool   `default:"false" env:"ORY_ENABLED"`
	OryKratosPrivateAddr string `default:"kratos-admin" env:"ORY_KRATOS_ADMIN_ADDR"`

	// Allow people who are not admin to create org
	CreateOrgEnabled bool `default:"false" env:"CREATE_ORG_ENABLED"`

	// audit
	AuditCleanCron               string `env:"AUDIT_CLEAN_CRON" default:"0 0 3 * * ?"`         // audit soft delete cron
	AuditArchiveCron             string `env:"AUDIT_ARCHIVE_CRON" default:"0 0 4 * * ?"`       // audit archive cron
	SysAuditCleanInterval        int    `env:"SYS_AUDIT_CLEAN_INTERVAL" default:"-30"`         // sys audit clean interval
	OrgAuditMaxRetentionDays     uint64 `env:"ORG_AUDIT_MAX_RETENTION_DAYS" default:"500"`     // org level audit max retention days
	OrgAuditDefaultRetentionDays uint64 `env:"ORG_AUDIT_DEFAULT_RETENTION_DAYS" default:"365"` // org level audit default retention days

	// erda-configs
	ErdaConfigsBasePath string `env:"ERDA_CONFIGS_BASE_PATH" default:"common-conf/erda-configs"`
}

Conf 定义基于环境变量的配置项

Jump to

Keyboard shortcuts

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