Cfg: Deduplicate DefaultOrgID code (#93588)

Cfg: Expose DefaultOrgID function
This commit is contained in:
Gabriel MABILLE
2024-09-23 16:50:11 +02:00
committed by GitHub
parent d38e2feab9
commit 7714b65f32
6 changed files with 14 additions and 31 deletions

View File

@@ -2051,3 +2051,10 @@ func (cfg *Cfg) readPublicDashboardsSettings() {
publicDashboards := cfg.Raw.Section("public_dashboards")
cfg.PublicDashboardsEnabled = publicDashboards.Key("enabled").MustBool(true)
}
func (cfg *Cfg) DefaultOrgID() int64 {
if cfg.AutoAssignOrg && cfg.AutoAssignOrgId > 0 {
return int64(cfg.AutoAssignOrgId)
}
return int64(1)
}