43 lines
872 B
Go
43 lines
872 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"pink_fox/inner"
|
|
"pink_fox/inner/config"
|
|
"pink_fox/inner/di"
|
|
"pink_fox/inner/storage"
|
|
"pink_fox/packages/fw"
|
|
)
|
|
|
|
func main() {
|
|
serverConfig := fw.ServerConfig[*storage.Storage, *di.Container]{
|
|
InitStorage: storage.New,
|
|
GetDebugMode: func(s *storage.Storage) bool {
|
|
return s.Debug
|
|
},
|
|
RegistrationRoutes: inner.RegistrationRoutes,
|
|
MakeContainer: di.MakeContainer,
|
|
CloseContainer: di.CloseContainer,
|
|
}
|
|
|
|
getConfig := func() (*fw.DatabaseConfig, fw.Error) {
|
|
return config.GetDatabaseConfig("/app/config.yml")
|
|
}
|
|
|
|
cli := fw.CLI{
|
|
Use: "pink_fox",
|
|
Short: "todo example project",
|
|
Commands: []fw.Command{
|
|
fw.GetCmdServer(serverConfig, 12001, "/app/config.yml"),
|
|
fw.GetCmdMigration(getConfig),
|
|
},
|
|
}
|
|
|
|
err := fw.Start(&cli)
|
|
if err != nil {
|
|
_, _ = fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(1)
|
|
}
|
|
}
|