diff --git a/conf/defaults.ini b/conf/defaults.ini index 2d3f108f5bd..93632560e13 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -94,6 +94,10 @@ read_timeout = 0 #exampleHeader1 = exampleValue1 #exampleHeader2 = exampleValue2 +[environment] +# Sets whether the local file system is available for Grafana to use. Default is true for backward compatibility. +local_file_system_available = true + #################################### GRPC Server ######################### [grpc_server] network = "tcp" diff --git a/packages/grafana-data/src/types/config.ts b/packages/grafana-data/src/types/config.ts index c3e4cea9b05..d5a2c259bae 100644 --- a/packages/grafana-data/src/types/config.ts +++ b/packages/grafana-data/src/types/config.ts @@ -226,6 +226,7 @@ export interface GrafanaConfig { sqlConnectionLimits: SqlConnectionLimits; sharedWithMeFolderUID?: string; rootFolderUID?: string; + localFileSystemAvailable?: boolean; // The namespace to use for kubernetes apiserver requests namespace: string; diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index 2ff143918db..30719098512 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -171,6 +171,7 @@ export class GrafanaBootConfig implements GrafanaConfig { disableFrontendSandboxForPlugins: string[] = []; sharedWithMeFolderUID: string | undefined; rootFolderUID: string | undefined; + localFileSystemAvailable: boolean | undefined; constructor(options: GrafanaBootConfig) { this.bootData = options.bootData; diff --git a/pkg/api/dtos/frontend_settings.go b/pkg/api/dtos/frontend_settings.go index 8c9bcd6ee8a..10c7853176d 100644 --- a/pkg/api/dtos/frontend_settings.go +++ b/pkg/api/dtos/frontend_settings.go @@ -260,4 +260,6 @@ type FrontendSettingsDTO struct { // Enterprise Licensing *FrontendSettingsLicensingDTO `json:"licensing,omitempty"` Whitelabeling *FrontendSettingsWhitelabelingDTO `json:"whitelabeling,omitempty"` + + LocalFileSystemAvailable bool `json:"localFileSystemAvailable"` } diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index bc4ca18ffb1..29d678c100f 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -220,6 +220,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro PublicDashboardsEnabled: hs.Cfg.PublicDashboardsEnabled, SharedWithMeFolderUID: folder.SharedWithMeFolderUID, RootFolderUID: accesscontrol.GeneralFolderUID, + LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable, BuildInfo: dtos.FrontendSettingsBuildInfoDTO{ HideVersion: hideVersion, diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 9a25a70badd..d9f8f487ced 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -366,6 +366,8 @@ type Cfg struct { StackID string Slug string + LocalFileSystemAvailable bool + // Deprecated ForceMigration bool @@ -1063,6 +1065,7 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error { cfg.Env = valueAsString(iniFile.Section(""), "app_mode", "development") cfg.StackID = valueAsString(iniFile.Section("environment"), "stack_id", "") cfg.Slug = valueAsString(iniFile.Section("environment"), "stack_slug", "") + cfg.LocalFileSystemAvailable = iniFile.Section("environment").Key("local_file_system_available").MustBool(true) //nolint:staticcheck cfg.ForceMigration = iniFile.Section("").Key("force_migration").MustBool(false) cfg.InstanceName = valueAsString(iniFile.Section(""), "instance_name", "unknown_instance_name") diff --git a/public/app/features/auth-config/fields.tsx b/public/app/features/auth-config/fields.tsx index 4a93b8f1cc5..5a095e4f954 100644 --- a/public/app/features/auth-config/fields.tsx +++ b/public/app/features/auth-config/fields.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { validate as uuidValidate } from 'uuid'; +import { config } from '@grafana/runtime'; import { TextLink } from '@grafana/ui'; import { contextSrv } from 'app/core/core'; @@ -342,16 +343,19 @@ export function fieldMap(provider: string): Record { label: 'TLS client ca', description: 'The file path to the trusted certificate authority list. Is not applicable on Grafana Cloud.', type: 'text', + hidden: !config.localFileSystemAvailable, }, tlsClientCert: { label: 'TLS client cert', description: 'The file path to the certificate. Is not applicable on Grafana Cloud.', type: 'text', + hidden: !config.localFileSystemAvailable, }, tlsClientKey: { label: 'TLS client key', description: 'The file path to the key. Is not applicable on Grafana Cloud.', type: 'text', + hidden: !config.localFileSystemAvailable, }, tlsSkipVerifyInsecure: { label: 'TLS skip verify',