Skip to content

Commit 956c9c5

Browse files
authored
Merge pull request #8 from sitedog-io/simplify-push
Simplify push + new auth flow
2 parents 797136d + 2803ad0 commit 956c9c5

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

main.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ func openBrowser(url string) {
242242
func handlePush() {
243243
pushFlags := flag.NewFlagSet("push", flag.ExitOnError)
244244
configFile := pushFlags.String("config", defaultConfigPath, "Path to config file")
245-
configName := pushFlags.String("title", "", "Configuration title")
246245
remoteURL := pushFlags.String("remote", "", "Custom API base URL (e.g., localhost:3000, api.example.com)")
247-
namespace := pushFlags.String("namespace", "", "Namespace for the configuration (e.g., my-group)")
248246
pushFlags.Parse(os.Args[2:])
249247

250248
if _, err := os.Stat(*configFile); err != nil {
@@ -277,24 +275,14 @@ func handlePush() {
277275
os.Exit(1)
278276
}
279277

280-
// Get configuration name from directory name if not specified
281-
if *configName == "" {
282-
dir, err := os.Getwd()
283-
if err != nil {
284-
fmt.Println("Error getting current directory:", err)
285-
os.Exit(1)
286-
}
287-
*configName = filepath.Base(dir)
288-
}
289-
290278
// Send configuration to server
291-
err = pushConfig(token, *configName, string(config), apiURL, *namespace)
279+
err = pushConfig(token, string(config), apiURL)
292280
if err != nil {
293281
fmt.Println("Error pushing config:", err)
294282
os.Exit(1)
295283
}
296284

297-
fmt.Printf("Configuration '%s' pushed successfully to %s!\n", *configName, apiURL)
285+
fmt.Printf("Configuration pushed successfully to %s!\n", apiURL)
298286
}
299287

300288
// isTerminalInteractive checks if we're running in an interactive terminal
@@ -412,11 +400,9 @@ func validatePincode(apiURL, pincode string) (string, error) {
412400
return result.Token, nil
413401
}
414402

415-
func pushConfig(token, name, content, apiURL, namespace string) error {
403+
func pushConfig(token, content, apiURL string) error {
416404
reqBody, err := json.Marshal(map[string]string{
417-
"name": name,
418405
"content": content,
419-
"namespace": namespace,
420406
})
421407
if err != nil {
422408
return fmt.Errorf("error creating request: %v", err)

0 commit comments

Comments
 (0)