...

Source file src/github.com/redhat-developer/odo/pkg/preference/variables.go

Documentation: github.com/redhat-developer/odo/pkg/preference

     1  package preference
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"time"
     7  
     8  	"github.com/redhat-developer/odo/pkg/util"
     9  )
    10  
    11  const (
    12  	GlobalConfigEnvName  = "GLOBALODOCONFIG"
    13  	configFileName       = "preference.yaml"
    14  	preferenceKind       = "Preference"
    15  	preferenceAPIVersion = "odo.dev/v1alpha1"
    16  
    17  	// minimumDurationValue is the minimum acceptable value for preferences that accept time.Duration
    18  	minimumDurationValue = 1 * time.Second
    19  
    20  	// DefaultTimeout for cluster server connection check (in seconds)
    21  	DefaultTimeout = 1 * time.Second
    22  
    23  	// DefaultPushTimeout is the default timeout for pods (in seconds)
    24  	DefaultPushTimeout = 240 * time.Second
    25  
    26  	// UpdateNotificationSetting is the name of the setting controlling update notification
    27  	UpdateNotificationSetting = "UpdateNotification"
    28  
    29  	// UpdateNotificationSettingDescription is human-readable description for the update notification setting
    30  	UpdateNotificationSettingDescription = "Flag to control if an update notification is shown or not (Default: true)"
    31  
    32  	// TimeoutSetting is the name of the setting controlling timeout for connection check
    33  	TimeoutSetting = "Timeout"
    34  
    35  	// PushTimeoutSetting is the name of the setting controlling PushTimeout
    36  	PushTimeoutSetting = "PushTimeout"
    37  
    38  	// RegistryCacheTimeSetting is human-readable description for the registrycachetime setting
    39  	RegistryCacheTimeSetting = "RegistryCacheTime"
    40  
    41  	// ImageRegistrySetting is the name of the setting controlling ImageRegistry
    42  	ImageRegistrySetting = "ImageRegistry"
    43  
    44  	// DefaultDevfileRegistryName is the name of default devfile registry
    45  	DefaultDevfileRegistryName = "DefaultDevfileRegistry"
    46  
    47  	// DefaultDevfileRegistryURL is the URL of default devfile registry
    48  	DefaultDevfileRegistryURL = "https://registry.devfile.io"
    49  
    50  	// OldDefaultDevfileRegistryURL is the URL of old default devfile registry for registry migration purpose
    51  	OldDefaultDevfileRegistryURL = "https://github.com/odo-devfiles/registry"
    52  
    53  	// DefaultRegistryCacheTime is time (in minutes) for how long odo will cache information from Devfile registry
    54  	DefaultRegistryCacheTime = 15 * time.Minute
    55  
    56  	// EphemeralSetting specifies if ephemeral volumes needs to be used as source volume.
    57  	EphemeralSetting = "Ephemeral"
    58  
    59  	// DefaultEphemeralSetting is a default value for Ephemeral preference
    60  	DefaultEphemeralSetting = false
    61  
    62  	// ConsentTelemetrySettings specifies if the user consents to telemetry
    63  	ConsentTelemetrySetting = "ConsentTelemetry"
    64  
    65  	// DefaultConsentTelemetry is a default value for ConsentTelemetry preference
    66  	DefaultConsentTelemetrySetting = false
    67  )
    68  
    69  // TimeoutSettingDescription is human-readable description for the timeout setting
    70  var TimeoutSettingDescription = fmt.Sprintf("Timeout (in Duration) for cluster server connection check (Default: %s)", DefaultTimeout)
    71  
    72  // PushTimeoutSettingDescription adds a description for PushTimeout
    73  var PushTimeoutSettingDescription = fmt.Sprintf("PushTimeout (in Duration) for waiting for a Pod to come up (Default: %s)", DefaultPushTimeout)
    74  
    75  // RegistryCacheTimeSettingDescription adds a description for RegistryCacheTime
    76  var RegistryCacheTimeSettingDescription = fmt.Sprintf("For how long (in Duration) odo will cache information from the Devfile registry (Default: %s)", DefaultRegistryCacheTime)
    77  
    78  // EphemeralSettingDescription adds a description for EphemeralSourceVolume
    79  var EphemeralSettingDescription = fmt.Sprintf("If true, odo will create an emptyDir volume to store source code (Default: %t)", DefaultEphemeralSetting)
    80  
    81  // ConsentTelemetrySettingDescription adds a description for TelemetryConsentSetting
    82  var ConsentTelemetrySettingDescription = fmt.Sprintf("If true, odo will collect telemetry for the user's odo usage (Default: %t)\n\t\t    For more information: https://developers.redhat.com/article/tool-data-collection", DefaultConsentTelemetrySetting)
    83  
    84  const ImageRegistrySettingDescription = "Image Registry to which relative image names in Devfile Image Components will be pushed to (Example: quay.io/my-user/)"
    85  
    86  // This value can be provided to set a seperate directory for users 'homedir' resolution
    87  // note for mocking purpose ONLY
    88  var customHomeDir = os.Getenv("CUSTOM_HOMEDIR")
    89  
    90  var (
    91  	// records information on supported parameters
    92  	supportedParameterDescriptions = map[string]string{
    93  		UpdateNotificationSetting: UpdateNotificationSettingDescription,
    94  		TimeoutSetting:            TimeoutSettingDescription,
    95  		PushTimeoutSetting:        PushTimeoutSettingDescription,
    96  		RegistryCacheTimeSetting:  RegistryCacheTimeSettingDescription,
    97  		EphemeralSetting:          EphemeralSettingDescription,
    98  		ConsentTelemetrySetting:   ConsentTelemetrySettingDescription,
    99  		ImageRegistrySetting:      ImageRegistrySettingDescription,
   100  	}
   101  
   102  	// set-like map to quickly check if a parameter is supported
   103  	lowerCaseParameters = util.GetLowerCaseParameters(GetSupportedParameters())
   104  )
   105  

View as plain text