You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
517 B
Go
29 lines
517 B
Go
package configgen
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/tal-tech/go-zero/tools/modelctl/model"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var (
|
|
configFileName = "config.json"
|
|
)
|
|
|
|
func ConfigCommand(_ *cli.Context) error {
|
|
_, err := os.Stat(configFileName)
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
file, err := os.OpenFile(configFileName, os.O_CREATE|os.O_WRONLY, model.ModeDirPerm)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
file.WriteString(configTemplate)
|
|
defer file.Close()
|
|
fmt.Println("config json template generate done ... ")
|
|
return nil
|
|
}
|