MCPcopy Index your code
hub / github.com/dnote/dnote / createApp

Function createApp

pkg/server/cmd/helpers.go:115–134  ·  view source on GitHub ↗

createApp creates config, initializes app, and returns cleanup function

(fs *flag.FlagSet, dbPath string)

Source from the content-addressed store, hash-verified

113
114// createApp creates config, initializes app, and returns cleanup function
115func createApp(fs *flag.FlagSet, dbPath string) (*app.App, func()) {
116 cfg, err := config.New(config.Params{
117 DBPath: dbPath,
118 })
119 if err != nil {
120 fmt.Printf("Error: %s\n\n", err)
121 fs.Usage()
122 os.Exit(1)
123 }
124
125 a := initApp(cfg)
126 cleanup := func() {
127 sqlDB, err := a.DB.DB()
128 if err == nil {
129 sqlDB.Close()
130 }
131 }
132
133 return &a, cleanup
134}

Callers 4

userCreateCmdFunction · 0.85
userRemoveCmdFunction · 0.85
userResetPasswordCmdFunction · 0.85
userListCmdFunction · 0.85

Calls 3

NewFunction · 0.92
initAppFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected