mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove public vars in setting package (#81018)
Removes the public variable setting.SecretKey plus some other ones. Introduces some new functions for creating setting.Cfg.
This commit is contained in:
committed by
GitHub
parent
147bf01745
commit
6768c6c059
@@ -116,7 +116,7 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, prefs *pref.Prefere
|
||||
treeRoot.AddSection(dashboardLink)
|
||||
}
|
||||
|
||||
if setting.ExploreEnabled && hasAccess(ac.EvalPermission(ac.ActionDatasourcesExplore)) {
|
||||
if s.cfg.ExploreEnabled && hasAccess(ac.EvalPermission(ac.ActionDatasourcesExplore)) {
|
||||
exploreChildNavLinks := s.buildExploreNavLinks(c)
|
||||
treeRoot.AddSection(&navtree.NavLink{
|
||||
Text: "Explore",
|
||||
@@ -129,14 +129,14 @@ func (s *ServiceImpl) GetNavTree(c *contextmodel.ReqContext, prefs *pref.Prefere
|
||||
})
|
||||
}
|
||||
|
||||
if setting.ProfileEnabled && c.IsSignedIn {
|
||||
if s.cfg.ProfileEnabled && c.IsSignedIn {
|
||||
treeRoot.AddSection(s.getProfileNode(c))
|
||||
}
|
||||
|
||||
_, uaIsDisabledForOrg := s.cfg.UnifiedAlerting.DisabledOrgs[c.SignedInUser.GetOrgID()]
|
||||
uaVisibleForOrg := s.cfg.UnifiedAlerting.IsEnabled() && !uaIsDisabledForOrg
|
||||
|
||||
if setting.AlertingEnabled != nil && *setting.AlertingEnabled {
|
||||
if s.cfg.AlertingEnabled != nil && *(s.cfg.AlertingEnabled) {
|
||||
if legacyAlertSection := s.buildLegacyAlertNavLinks(c); legacyAlertSection != nil {
|
||||
treeRoot.AddSection(legacyAlertSection)
|
||||
}
|
||||
@@ -208,7 +208,7 @@ func getShortCommitHash(commitHash string, maxLength int) string {
|
||||
}
|
||||
|
||||
func (s *ServiceImpl) addHelpLinks(treeRoot *navtree.NavTreeRoot, c *contextmodel.ReqContext) {
|
||||
if setting.HelpEnabled {
|
||||
if s.cfg.HelpEnabled {
|
||||
helpVersion := fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, getShortCommitHash(setting.BuildCommit, 10))
|
||||
if s.cfg.AnonymousHideVersion && !c.IsSignedIn {
|
||||
helpVersion = setting.ApplicationName
|
||||
@@ -252,7 +252,7 @@ func (s *ServiceImpl) getProfileNode(c *contextmodel.ReqContext) *navtree.NavLin
|
||||
if c.SignedInUser.GetLogin() != c.SignedInUser.GetDisplayName() {
|
||||
login = c.SignedInUser.GetLogin()
|
||||
}
|
||||
gravatarURL := dtos.GetGravatarUrl(c.SignedInUser.GetEmail())
|
||||
gravatarURL := dtos.GetGravatarUrl(s.cfg, c.SignedInUser.GetEmail())
|
||||
|
||||
children := []*navtree.NavLink{
|
||||
{
|
||||
@@ -271,7 +271,7 @@ func (s *ServiceImpl) getProfileNode(c *contextmodel.ReqContext) *navtree.NavLin
|
||||
})
|
||||
}
|
||||
|
||||
if !setting.DisableSignoutMenu {
|
||||
if !s.cfg.DisableSignoutMenu {
|
||||
// add sign out first
|
||||
children = append(children, &navtree.NavLink{
|
||||
Text: "Sign out",
|
||||
|
||||
Reference in New Issue
Block a user