# README
Bootstrap
When writing a go-lanai application, the developer selects the go-lanai module they want to use. Bootstrap refers to the process of how the application instantiate the components needed by the modules and wires them together.
Under the hood, the bootstrapper keeps a registry of modules that's enabled in this application.
A module is implemented as a group of fx.Provide
and fx.Invoke
options.
When the app starts, all module added fx.provide
and fx.invoke
options are sorted and executed.
In go-lanai's module packages, you'll usually see a function like this:
package init
var Module = &bootstrap.Module{
Name: "web",
Precedence: web.MinWebPrecedence,
PriorityOptions: []fx.Option{
appconfig.FxEmbeddedDefaults(defaultConfigFS),
fx.Provide(
web.BindServerProperties,
web.NewEngine,
web.NewRegistrar),
fx.Invoke(setup),
},
}
// Use Allow service to include this module in main()
func Use() {
bootstrap.Register(Module)
bootstrap.Register(cors.Module)
}
This Use() method registers the module with the bootstrapper. The application
code just needs to call the Use()
function to indicate this module should be activated in the application.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
AddStringFlag should be called before Execute() to register flags that are supported.
DebugEnabled returns false by default, unless environment variable DEBUG is set or application start with --debug.
EnableCliRunnerMode should be called before Execute(), otherwise it won't run.
Execute run globally configured application.
ExecuteContainedApp is similar to Execute, but run with a separately configured Bootstrapper.
GlobalBootstrapper returns globally configured Bootstrapper.
InitModule returns the module that would run with highest priority.
MiscModules returns the module that would run with various precedence.
No description provided by the author
No description provided by the author
NewBootstrapper create a new Bootstrapper.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
CommandLineRunnerPrecedence invocation should happen after everything else, in case it needs functionality from any other modules.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
min int.
No description provided by the author
No description provided by the author
max int.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
ApplicationContext is a Context carries addition data for application.
No description provided by the author
Bootstrapper stores application configurations for bootstrapping.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
No description provided by the author
No description provided by the author
CliRunnerLifecycleHooks provide instrumentation around CliRunners.
# Type aliases
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author