conf

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 10 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 DisableFileDownloadPermissionValidate

func DisableFileDownloadPermissionValidate() bool

DisableFileDownloadPermissionValidate return switch for file download permission check.

func EnableNS

func EnableNS() bool

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

func FileMaxMemorySize

func FileMaxMemorySize() datasize.ByteSize

FileMaxMemorySize return the size of the file parts stored in memory

func FileMaxUploadSize

func FileMaxUploadSize() datasize.ByteSize

FileMaxUploadSize 返回 文件上传的大小限制.

func FileTypeCarryActiveContentAllowed added in v1.3.0

func FileTypeCarryActiveContentAllowed() bool

func FileTypesCanCarryActiveContent added in v1.3.0

func FileTypesCanCarryActiveContent() []string

func GittarOutterURL

func GittarOutterURL() string

GittarOutterURL 返回 GittarOutterURL 选项.

func LegacyUIDomain

func LegacyUIDomain() string

LegacyUIDomain

func LicenseKey

func LicenseKey() string

LicenseKey 返回 LicenseKey 选项.

func ListenAddr

func ListenAddr() string

ListenAddr 返回 ListenAddr 选项.

func Load

func Load()

Load 加载配置项.

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 OSSAccessID

func OSSAccessID() string

OSSAccessID 返回 oss access id.

func OSSAccessSecret

func OSSAccessSecret() string

OSSAccessSecret 返回 oss access secret

func OSSBucket

func OSSBucket() string

OSSBucket 返回 oss bucket.

func OSSEndpoint

func OSSEndpoint() string

OSSEndpoint 返回 oss endpoint.

func OSSPathPrefix

func OSSPathPrefix() string

OSSPathPrefix 返回 文件在指定 bucket 下的路径前缀.

func OpenAPIDomain

func OpenAPIDomain() string

OpenAPIDomain 返回 OpenAPIDomain 选项

func OrgAuditMaxRetentionDays added in v1.3.0

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 StorageMountPointInContainer

func StorageMountPointInContainer() string

StorageMountPointInContainer 返回 files 在容器内的挂载点.

func SysAuditCleanInterval added in v1.3.0

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"`
	ListenAddr            string `env:"LISTEN_ADDR" default:":9526"`
	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"`

	// 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"`

	// --- 文件管理 begin ---
	FileMaxUploadSizeStr string `env:"FILE_MAX_UPLOAD_SIZE" default:"300MB"` // 文件上传限制大小,默认 300MB
	FileMaxUploadSize    datasize.ByteSize
	// the size of the file parts stored in memory, the default value 32M refer to https://github.com/golang/go/blob/5c489514bc5e61ad9b5b07bd7d8ec65d66a0512a/src/net/http/request.go
	FileMaxMemorySizeStr string `env:"FILE_MAX_MEMORY_SIZE" default:"32MB"`
	FileMaxMemorySize    datasize.ByteSize

	// disable file download permission validate temporarily for multi-domain
	DisableFileDownloadPermissionValidate bool `env:"DISABLE_FILE_DOWNLOAD_PERMISSION_VALIDATE" default:"false"`

	// fs
	// 修改该值的话,注意同步修改 dice.yml 中 '<%$.Storage.MountPoint%>/dice/cmdb/files:/files:rw' 容器内挂载点的值
	StorageMountPointInContainer string `env:"STORAGE_MOUNT_POINT_IN_CONTAINER" default:"/files"`

	// oss
	OSSEndpoint     string `env:"OSS_ENDPOINT"`
	OSSAccessID     string `env:"OSS_ACCESS_ID"`
	OSSAccessSecret string `env:"OSS_ACCESS_SECRET"`
	OSSBucket       string `env:"OSS_BUCKET"`
	OSSPathPrefix   string `env:"OSS_PATH_PREFIX" default:"/dice/cmdb/files"`

	// If we allow uploaded file types that can carry active content
	FileTypeCarryActiveContentAllowed bool `env:"FILETYPE_CARRY_ACTIVE_CONTENT_ALLOWED" default:"false"`
	// File types can carry active content, separated by comma, can add more types like jsp
	FileTypesCanCarryActiveContent string `env:"FILETYPES_CAN_CARRY_ACTIVE_CONTENT" default:"html,js,xml,htm"`

	// 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:"-7"`      // sys audit clean interval
	OrgAuditMaxRetentionDays uint64 `env:"ORG_AUDIT_MAX_RETENTION_DAYS" default:"180"` // org level audit max retention days
}

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

Jump to

Keyboard shortcuts

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