Skip to content

Commit dd7801a

Browse files
committed
fix url casing in var names
Signed-off-by: Michael Beemer <[email protected]>
1 parent e46ad70 commit dd7801a

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

internal/cmd/init.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,40 +84,40 @@ func handleManifestCreation(manifestPath string, override bool) error {
8484
return nil
8585
}
8686

87-
func handleConfigFile(providerUrl string, override bool) error {
87+
func handleConfigFile(providerURL string, override bool) error {
8888
configPath := ".openfeature.yaml"
8989
configExists, err := filesystem.Exists(configPath)
9090
if err != nil {
9191
return fmt.Errorf("failed to check if config file exists: %w", err)
9292
}
9393

9494
if !configExists {
95-
return writeConfigFile(providerUrl, "Creating .openfeature.yaml configuration file")
95+
return writeConfigFile(providerURL, "Creating .openfeature.yaml configuration file")
9696
}
9797

98-
if providerUrl == "" {
98+
if providerURL == "" {
9999
return nil // no config to write
100100
}
101101

102102
if override {
103-
return writeConfigFile(providerUrl, "Updating provider URL in .openfeature.yaml")
103+
return writeConfigFile(providerURL, "Updating provider URL in .openfeature.yaml")
104104
}
105105

106106
shouldOverride, err := confirmOverride("configuration file", configPath)
107107
if err != nil {
108108
return fmt.Errorf("failed to get user confirmation: %w", err)
109109
}
110110
if shouldOverride {
111-
return writeConfigFile(providerUrl, "Updating provider URL in .openfeature.yaml")
111+
return writeConfigFile(providerURL, "Updating provider URL in .openfeature.yaml")
112112
}
113113

114114
logger.Default.Info("Configuration file was not modified.")
115115
return nil
116116
}
117117

118-
func writeConfigFile(providerUrl, message string) error {
119-
pterm.Info.Println(message, pterm.LightWhite(providerUrl))
120-
template := getConfigTemplate(providerUrl)
118+
func writeConfigFile(providerURL, message string) error {
119+
pterm.Info.Println(message, pterm.LightWhite(providerURL))
120+
template := getConfigTemplate(providerURL)
121121
return filesystem.WriteFile(".openfeature.yaml", []byte(template))
122122
}
123123

@@ -180,12 +180,12 @@ const configTemplateText = `# OpenFeature CLI Configuration
180180
# package-name: "com.example.openfeature"
181181
`
182182

183-
func getConfigTemplate(providerUrl string) string {
183+
func getConfigTemplate(providerURL string) string {
184184
tmpl := template.Must(template.New("config").Parse(configTemplateText))
185185

186186
data := configTemplateData{
187-
ProviderURL: providerUrl,
188-
HasProviderURL: providerUrl != "",
187+
ProviderURL: providerURL,
188+
HasProviderURL: providerURL != "",
189189
}
190190

191191
var buf bytes.Buffer

internal/cmd/pull.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ Why pull from a remote source:
4242
return initializeConfig(cmd, "pull")
4343
},
4444
RunE: func(cmd *cobra.Command, args []string) error {
45-
providerUrl := config.GetFlagSourceUrl(cmd)
45+
providerURL := config.GetFlagSourceUrl(cmd)
4646
manifestPath := config.GetManifestPath(cmd)
4747
authToken := config.GetAuthToken(cmd)
4848
noPrompt := config.GetNoPrompt(cmd)
4949

50-
if providerUrl == "" {
50+
if providerURL == "" {
5151
return fmt.Errorf("provider URL not set in config. Please provide --provider-url or set 'provider' in .openfeature.yaml")
5252
}
5353

5454
// fetch the flags from the remote source
55-
parsedURL, err := url.Parse(providerUrl)
55+
parsedURL, err := url.Parse(providerURL)
5656
if err != nil {
5757
return fmt.Errorf("invalid URL: %w", err)
5858
}
@@ -69,14 +69,14 @@ Why pull from a remote source:
6969
urlContainsAFileExtension := manifest.URLLooksLikeAFile(parsedURL.String())
7070
if urlContainsAFileExtension {
7171
// Use direct HTTP requests for pulling flags from file-like URLs
72-
loadedFlags, err := manifest.LoadFromRemote(providerUrl, authToken)
72+
loadedFlags, err := manifest.LoadFromRemote(providerURL, authToken)
7373
if err != nil {
7474
return fmt.Errorf("error fetching flags from remote source: %w", err)
7575
}
7676
flags = loadedFlags
7777
} else {
7878
// Use the sync API client for pulling flags
79-
loadedFlags, err := manifest.LoadFromSyncAPI(providerUrl, authToken)
79+
loadedFlags, err := manifest.LoadFromSyncAPI(providerURL, authToken)
8080
if err != nil {
8181
return fmt.Errorf("error fetching flags from remote source: %w", err)
8282
}
@@ -101,7 +101,7 @@ Why pull from a remote source:
101101
}
102102
}
103103

104-
pterm.Success.Printfln("Successfully fetched flags from %s", providerUrl)
104+
pterm.Success.Printfln("Successfully fetched flags from %s", providerURL)
105105
if err := manifest.Write(manifestPath, *flags); err != nil {
106106
return fmt.Errorf("error writing manifest: %w", err)
107107
}

internal/cmd/push.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ For local file operations, use standard shell commands like cp or mv.`,
5555
},
5656
RunE: func(cmd *cobra.Command, args []string) error {
5757
// Get configuration values
58-
providerUrl := config.GetFlagSourceUrl(cmd)
58+
providerURL := config.GetFlagSourceUrl(cmd)
5959
manifestPath := config.GetManifestPath(cmd)
6060
authToken := config.GetAuthToken(cmd)
6161
dryRun := config.GetDryRun(cmd)
6262

6363
// Validate destination URL is provided
64-
if providerUrl == "" {
64+
if providerURL == "" {
6565
return fmt.Errorf("provider URL is required. Please provide --provider-url")
6666
}
6767

6868
// Parse and validate URL
69-
parsedURL, err := url.Parse(providerUrl)
69+
parsedURL, err := url.Parse(providerURL)
7070
if err != nil {
7171
return fmt.Errorf("invalid source URL: %w", err)
7272
}
@@ -86,13 +86,13 @@ For local file operations, use standard shell commands like cp or mv.`,
8686
case "http", "https":
8787
// Perform smart push (fetches remote, compares, and creates/updates as needed)
8888
// In dry run mode, performs comparison but skips actual API calls
89-
result, err := manifest.SaveToRemote(providerUrl, flags, authToken, dryRun)
89+
result, err := manifest.SaveToRemote(providerURL, flags, authToken, dryRun)
9090
if err != nil {
9191
return fmt.Errorf("error pushing flags to remote destination: %w", err)
9292
}
9393

9494
// Display the results
95-
displayPushResults(result, providerUrl, dryRun)
95+
displayPushResults(result, providerURL, dryRun)
9696
default:
9797
return fmt.Errorf("unsupported URL scheme: %s. Supported schemes are http:// and https://", parsedURL.Scheme)
9898
}
@@ -189,7 +189,7 @@ func displayPushResults(result *sync.PushResult, destination string, dryRun bool
189189
fmt.Println()
190190

191191
// Show flag details
192-
flagJSON, _ := json.MarshalIndent(map[string]interface{}{
192+
flagJSON, _ := json.MarshalIndent(map[string]any{
193193
"type": flag.Type.String(),
194194
"defaultValue": flag.DefaultValue,
195195
}, " ", " ")

0 commit comments

Comments
 (0)