setting

package
v6.0.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP              Scheme = "http"
	HTTPS             Scheme = "https"
	SOCKET            Scheme = "socket"
	DEFAULT_HTTP_ADDR string = "0.0.0.0"
)
View Source
const (
	DEV                 = "development"
	PROD                = "production"
	TEST                = "test"
	APP_NAME            = "Grafana"
	APP_NAME_ENTERPRISE = "Grafana Enterprise"
)

Variables

View Source
var (
	// App settings.
	Env          = DEV
	AppUrl       string
	AppSubUrl    string
	InstanceName string

	// build
	BuildVersion    string
	BuildCommit     string
	BuildBranch     string
	BuildStamp      int64
	IsEnterprise    bool
	ApplicationName string

	// packaging
	Packaging = "unknown"

	// Paths
	HomePath       string
	PluginsPath    string
	CustomInitPath = "conf/custom.ini"

	// Log settings.
	LogConfigs []util.DynMap

	// Http server options
	Protocol           Scheme
	Domain             string
	HttpAddr, HttpPort string
	SshPort            int
	CertFile, KeyFile  string
	SocketPath         string
	RouterLogging      bool
	DataProxyLogging   bool
	DataProxyTimeout   int
	StaticRootPath     string
	EnableGzip         bool
	EnforceDomain      bool

	// Security settings.
	SecretKey                        string
	DisableGravatar                  bool
	EmailCodeValidMinutes            int
	DataProxyWhiteList               map[string]bool
	DisableBruteForceLoginProtection bool

	// Snapshots
	ExternalSnapshotUrl   string
	ExternalSnapshotName  string
	ExternalEnabled       bool
	SnapShotRemoveExpired bool

	// Dashboard history
	DashboardVersionsToKeep int

	// User settings
	AllowUserSignUp         bool
	AllowUserOrgCreate      bool
	AutoAssignOrg           bool
	AutoAssignOrgId         int
	AutoAssignOrgRole       string
	VerifyEmailEnabled      bool
	LoginHint               string
	DefaultTheme            string
	DisableLoginForm        bool
	DisableSignoutMenu      bool
	SignoutRedirectUrl      string
	ExternalUserMngLinkUrl  string
	ExternalUserMngLinkName string
	ExternalUserMngInfo     string
	OAuthAutoLogin          bool
	ViewersCanEdit          bool

	// Http auth
	AdminUser     string
	AdminPassword string

	AnonymousEnabled bool
	AnonymousOrgName string
	AnonymousOrgRole string

	// Auth proxy settings
	AuthProxyEnabled        bool
	AuthProxyHeaderName     string
	AuthProxyHeaderProperty string
	AuthProxyAutoSignUp     bool
	AuthProxyLdapSyncTtl    int
	AuthProxyWhitelist      string
	AuthProxyHeaders        map[string]string

	// Basic Auth
	BasicAuthEnabled bool

	// Plugin settings
	PluginAppsSkipVerifyTLS bool

	// Session settings.
	SessionOptions         session.Options
	SessionConnMaxLifetime int64

	// Global setting objects.
	Raw          *ini.File
	ConfRootPath string
	IsWindows    bool

	ReportingEnabled   bool
	CheckForUpdates    bool
	GoogleAnalyticsId  string
	GoogleTagManagerId string

	// LDAP
	LdapEnabled     bool
	LdapConfigFile  string
	LdapAllowSignup = true

	// QUOTA
	Quota QuotaSettings

	// Alerting
	AlertingEnabled            bool
	ExecuteAlerts              bool
	AlertingRenderLimit        int
	AlertingErrorOrTimeout     string
	AlertingNoDataOrNullValues string

	// Explore UI
	ExploreEnabled bool

	// Grafana.NET URL
	GrafanaComUrl string

	// S3 temp image store
	S3TempImageStoreBucketUrl string
	S3TempImageStoreAccessKey string
	S3TempImageStoreSecretKey string

	ImageUploadProvider string
)
View Source
var (
	ERR_TEMPLATE_NAME = "error"
)

Functions

func ToAbsUrl

func ToAbsUrl(relativeUrl string) string

Types

type Cfg

type Cfg struct {
	Raw *ini.File

	// HTTP Server Settings
	AppUrl    string
	AppSubUrl string

	// Paths
	ProvisioningPath string
	DataPath         string
	LogsPath         string

	// SMTP email settings
	Smtp SmtpSettings

	// Rendering
	ImagesDir             string
	PhantomDir            string
	RendererUrl           string
	RendererCallbackUrl   string
	RendererLimit         int
	RendererLimitAlerting int

	DisableBruteForceLoginProtection bool
	TempDataLifetime                 time.Duration
	MetricsEndpointEnabled           bool
	MetricsEndpointBasicAuthUsername string
	MetricsEndpointBasicAuthPassword string
	EnableAlphaPanels                bool
	DisableSanitizeHtml              bool
	EnterpriseLicensePath            string

	LoginCookieName                   string
	LoginCookieMaxDays                int
	LoginCookieRotation               int
	LoginDeleteExpiredTokensAfterDays int

	SecurityHTTPSCookies bool
}

TODO move all global vars to this struct

func NewCfg

func NewCfg() *Cfg

func (*Cfg) Load

func (cfg *Cfg) Load(args *CommandLineArgs) error

func (*Cfg) LogConfigSources

func (cfg *Cfg) LogConfigSources()

type CommandLineArgs

type CommandLineArgs struct {
	Config   string
	HomePath string
	Args     []string
}

type GlobalQuota

type GlobalQuota struct {
	Org        int64 `target:"org"`
	User       int64 `target:"user"`
	DataSource int64 `target:"data_source"`
	Dashboard  int64 `target:"dashboard"`
	ApiKey     int64 `target:"api_key"`
	Session    int64 `target:"-"`
}

func (*GlobalQuota) ToMap

func (q *GlobalQuota) ToMap() map[string]int64

type OAuthInfo

type OAuthInfo struct {
	ClientId, ClientSecret       string
	Scopes                       []string
	AuthUrl, TokenUrl            string
	Enabled                      bool
	EmailAttributeName           string
	AllowedDomains               []string
	HostedDomain                 string
	ApiUrl                       string
	AllowSignup                  bool
	Name                         string
	TlsClientCert                string
	TlsClientKey                 string
	TlsClientCa                  string
	TlsSkipVerify                bool
	SendClientCredentialsViaPost bool
}

type OAuther

type OAuther struct {
	OAuthInfos map[string]*OAuthInfo
}
var OAuthService *OAuther

type OrgQuota

type OrgQuota struct {
	User       int64 `target:"org_user"`
	DataSource int64 `target:"data_source"`
	Dashboard  int64 `target:"dashboard"`
	ApiKey     int64 `target:"api_key"`
}

func (*OrgQuota) ToMap

func (q *OrgQuota) ToMap() map[string]int64

type QuotaSettings

type QuotaSettings struct {
	Enabled bool
	Org     *OrgQuota
	User    *UserQuota
	Global  *GlobalQuota
}

type Scheme

type Scheme string

type SmtpSettings

type SmtpSettings struct {
	Enabled      bool
	Host         string
	User         string
	Password     string
	CertFile     string
	KeyFile      string
	FromAddress  string
	FromName     string
	EhloIdentity string
	SkipVerify   bool

	SendWelcomeEmailOnSignUp bool
	TemplatesPattern         string
}

type UserQuota

type UserQuota struct {
	Org int64 `target:"org_user"`
}

func (*UserQuota) ToMap

func (q *UserQuota) ToMap() map[string]int64

Jump to

Keyboard shortcuts

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