...
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
18 minimumDurationValue = 1 * time.Second
19
20
21 DefaultTimeout = 1 * time.Second
22
23
24 DefaultPushTimeout = 240 * time.Second
25
26
27 UpdateNotificationSetting = "UpdateNotification"
28
29
30 UpdateNotificationSettingDescription = "Flag to control if an update notification is shown or not (Default: true)"
31
32
33 TimeoutSetting = "Timeout"
34
35
36 PushTimeoutSetting = "PushTimeout"
37
38
39 RegistryCacheTimeSetting = "RegistryCacheTime"
40
41
42 ImageRegistrySetting = "ImageRegistry"
43
44
45 DefaultDevfileRegistryName = "DefaultDevfileRegistry"
46
47
48 DefaultDevfileRegistryURL = "https://registry.devfile.io"
49
50
51 OldDefaultDevfileRegistryURL = "https://github.com/odo-devfiles/registry"
52
53
54 DefaultRegistryCacheTime = 15 * time.Minute
55
56
57 EphemeralSetting = "Ephemeral"
58
59
60 DefaultEphemeralSetting = false
61
62
63 ConsentTelemetrySetting = "ConsentTelemetry"
64
65
66 DefaultConsentTelemetrySetting = false
67 )
68
69
70 var TimeoutSettingDescription = fmt.Sprintf("Timeout (in Duration) for cluster server connection check (Default: %s)", DefaultTimeout)
71
72
73 var PushTimeoutSettingDescription = fmt.Sprintf("PushTimeout (in Duration) for waiting for a Pod to come up (Default: %s)", DefaultPushTimeout)
74
75
76 var RegistryCacheTimeSettingDescription = fmt.Sprintf("For how long (in Duration) odo will cache information from the Devfile registry (Default: %s)", DefaultRegistryCacheTime)
77
78
79 var EphemeralSettingDescription = fmt.Sprintf("If true, odo will create an emptyDir volume to store source code (Default: %t)", DefaultEphemeralSetting)
80
81
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
87
88 var customHomeDir = os.Getenv("CUSTOM_HOMEDIR")
89
90 var (
91
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
103 lowerCaseParameters = util.GetLowerCaseParameters(GetSupportedParameters())
104 )
105
View as plain text