MCPcopy
hub / github.com/pocketbase/pocketbase / eagerParseFlags

Method eagerParseFlags

pocketbase.go:219–249  ·  view source on GitHub ↗

eagerParseFlags parses the global app flags before calling pb.RootCmd.Execute(). so we can have all PocketBase flags ready for use on initialization.

(config *Config)

Source from the content-addressed store, hash-verified

217// eagerParseFlags parses the global app flags before calling pb.RootCmd.Execute().
218// so we can have all PocketBase flags ready for use on initialization.
219func (pb *PocketBase) eagerParseFlags(config *Config) error {
220 pb.RootCmd.PersistentFlags().StringVar(
221 &pb.dataDirFlag,
222 "dir",
223 config.DefaultDataDir,
224 "the PocketBase data directory",
225 )
226
227 pb.RootCmd.PersistentFlags().StringVar(
228 &pb.encryptionEnvFlag,
229 "encryptionEnv",
230 config.DefaultEncryptionEnv,
231 "the env variable whose value of 32 characters will be used \nas encryption key for the app settings (default none)",
232 )
233
234 pb.RootCmd.PersistentFlags().BoolVar(
235 &pb.devFlag,
236 "dev",
237 config.DefaultDev,
238 "enable dev mode, aka. printing logs and sql statements to the console",
239 )
240
241 pb.RootCmd.PersistentFlags().IntVar(
242 &pb.queryTimeout,
243 "queryTimeout",
244 int(config.DefaultQueryTimeout.Seconds()),
245 "the default SELECT queries timeout in seconds",
246 )
247
248 return pb.RootCmd.ParseFlags(os.Args[1:])
249}
250
251// skipBootstrap eagerly checks if the app should skip the bootstrap process:
252// - already bootstrapped

Callers 1

NewWithConfigFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected