Skip to content

Commit

Permalink
simplify initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
canercidam committed Dec 20, 2023
1 parent a17fd15 commit d5301b8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions cmd/cmd_init.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package cmd

import (
"bytes"
"errors"
"fmt"
"os"
"regexp"
"strings"
"text/template"

"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/fatih/color"
Expand All @@ -29,15 +27,7 @@ func handleFortaInit(cmd *cobra.Command, args []string) error {
}

if !isConfigFileInitialized() {
tmpl, err := template.New("config-template").Parse(defaultConfig)
if err != nil {
return err
}
var buf bytes.Buffer
if err := tmpl.Execute(&buf, nil); err != nil {
return err
}
if err := os.WriteFile(cfg.ConfigFilePath(), buf.Bytes(), 0644); err != nil {
if err := os.WriteFile(cfg.ConfigFilePath(), []byte(defaultConfig), 0644); err != nil {
return err
}
}
Expand Down

0 comments on commit d5301b8

Please sign in to comment.