-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (42 loc) · 1.53 KB
/
Copy pathmain.go
File metadata and controls
46 lines (42 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"context"
"os"
"github.com/darwishdev/devkit-cli/app/new"
"github.com/darwishdev/devkit-cli/app/seed"
"github.com/darwishdev/devkit-cli/cmd"
"github.com/darwishdev/devkit-cli/pkg/config"
"github.com/darwishdev/devkit-cli/pkg/db"
"github.com/darwishdev/devkit-cli/pkg/fileutils"
"github.com/darwishdev/devkit-cli/pkg/gitclient"
"github.com/darwishdev/devkit-cli/pkg/supabase"
"github.com/darwishdev/devkit-cli/pkg/templates"
"github.com/darwishdev/sqlseeder"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"golang.org/x/crypto/bcrypt"
)
func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
appConfig, err := config.NewConfig("$HOME/.config/devkitcli", "devkit", "./", "devkit")
if err != nil {
panic(err)
}
cliConfig := appConfig.GetCliConfig()
fileUtils := fileutils.NewFileUtils()
templateUtils := templates.NewTemplates("tmpls")
sqlSeeder := sqlseeder.NewSeeder(sqlseeder.SeederConfig{
HashFunc: func(pass string) string {
password, _ := bcrypt.GenerateFromPassword([]byte(pass), bcrypt.DefaultCost)
return string(password)
},
})
gitClient := gitclient.NewGitClientRepo(context.Background(), cliConfig.GithubToken)
dbUtils := db.NewDb()
supaClient := supabase.NewSupabaseClient()
seedCmd := seed.NewSeedCmd(appConfig, fileUtils, sqlSeeder, dbUtils, supaClient)
newCmd := new.NewNewCmd(appConfig, fileUtils, templateUtils, gitClient, dbUtils)
command := cmd.NewCommand(appConfig, newCmd, seedCmd)
command.Execute()
}