Skip to content

Commit

Permalink
add creation of .mantil during setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vlasic committed Aug 24, 2021
1 parent 97e345b commit bfed25a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/commands/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ type BackendConfig struct {
Token string
}

func CreateBackendConfigDir() error {
home, err := os.UserHomeDir()
if err != nil {
return err
}
return os.Mkdir(fmt.Sprintf("%s/.mantil", home), 0755)
}

func BackendConfigPath() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions internal/commands/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func (s *SetupCmd) create() error {
config := &commands.BackendConfig{
APIGatewayURL: rsp.APIGatewayURL,
}
if err := commands.CreateBackendConfigDir(); err != nil {
return fmt.Errorf("could not create backend config directory - %v", err)
}
if err := config.Save(); err != nil {
return fmt.Errorf("could not save backend config - %v", err)
}
Expand Down

0 comments on commit bfed25a

Please sign in to comment.