MCPcopy Create free account
hub / github.com/encodeous/nylon / Bootstrap

Function Bootstrap

core/entrypoint.go:104–138  ·  view source on GitHub ↗

Bootstrap provides startup logic in a real environment

(centralPath, nodePath, logPath string, verbose bool, opts state.NylonOptions)

Source from the content-addressed store, hash-verified

102
103// Bootstrap provides startup logic in a real environment
104func Bootstrap(centralPath, nodePath, logPath string, verbose bool, opts state.NylonOptions) {
105 setupDebugging(opts)
106 level := slog.LevelInfo
107 if verbose {
108 level = slog.LevelDebug
109 }
110
111 tunables := state.DefaultRouterTunables()
112 centralCfg, err := readCentralConfig(centralPath, nodePath, &tunables)
113 if err != nil {
114 fatal("failed to read central config", err)
115 }
116 nodeCfg, err := readNodeConfig(nodePath)
117 if err != nil {
118 fatal("failed to read node config", err)
119 }
120 if logPath != "" {
121 nodeCfg.LogPath = logPath
122 }
123
124 state.ExpandCentralConfig(centralCfg)
125 if err = state.CentralConfigValidator(centralCfg); err != nil {
126 fatal("invalid central config", err)
127 }
128 if err = state.NodeConfigValidator(centralCfg, nodeCfg); err != nil {
129 fatal("invalid node config", err)
130 }
131 n, err := NewNylon(*centralCfg, *nodeCfg, level, centralPath, nil, opts, nil)
132 if err != nil {
133 fatal("failed to initialize nylon", err)
134 }
135 if err = n.Start(); err != nil {
136 fatal("nylon exited with error", err)
137 }
138}

Callers 1

run.goFile · 0.92

Calls 10

StartMethod · 0.95
DefaultRouterTunablesFunction · 0.92
ExpandCentralConfigFunction · 0.92
CentralConfigValidatorFunction · 0.92
NodeConfigValidatorFunction · 0.92
setupDebuggingFunction · 0.85
readCentralConfigFunction · 0.85
fatalFunction · 0.85
readNodeConfigFunction · 0.85
NewNylonFunction · 0.85

Tested by

no test coverage detected