this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

init smallweb config on start

pomdtr c44ca139 6be5ff5d

+22
+22
cmd/init.go
··· 2 2 3 3 import ( 4 4 "embed" 5 + "encoding/json" 5 6 "fmt" 6 7 "io/fs" 7 8 "os" 9 + "path/filepath" 8 10 9 11 "github.com/spf13/cobra" 10 12 ) ··· 28 30 return fmt.Errorf("directory %s already exists", workspaceDir) 29 31 } 30 32 33 + domain := k.String("domain") 34 + if domain == "" { 35 + return fmt.Errorf("domain is required") 36 + } 37 + 31 38 if err := os.CopyFS(workspaceDir, workspaceFS); err != nil { 32 39 return fmt.Errorf("failed to copy workspace embed: %w", err) 40 + } 41 + 42 + if err := os.Mkdir(filepath.Join(workspaceDir, ".smallweb"), 0755); err != nil { 43 + return fmt.Errorf("failed to create .smallweb directory: %w", err) 44 + } 45 + 46 + configBytes, err := json.MarshalIndent(map[string]interface{}{ 47 + "domain": domain, 48 + }, "", " ") 49 + if err != nil { 50 + return fmt.Errorf("failed to marshal config: %w", err) 51 + } 52 + 53 + if err := os.WriteFile(filepath.Join(workspaceDir, ".smallweb", "config.json"), configBytes, 0644); err != nil { 54 + return fmt.Errorf("failed to write config: %w", err) 33 55 } 34 56 35 57 fmt.Fprintf(cmd.ErrOrStderr(), "Workspace initialized at %s\n", workspaceDir)