MCPcopy Create free account
hub / github.com/netlify/gotrue / NewAPIFromConfigFile

Function NewAPIFromConfigFile

api/api.go:196–218  ·  view source on GitHub ↗

NewAPIFromConfigFile creates a new REST API using the provided configuration file.

(filename string, version string)

Source from the content-addressed store, hash-verified

194
195// NewAPIFromConfigFile creates a new REST API using the provided configuration file.
196func NewAPIFromConfigFile(filename string, version string) (*API, *conf.Configuration, error) {
197 globalConfig, err := conf.LoadGlobal(filename)
198 if err != nil {
199 return nil, nil, err
200 }
201
202 config, err := conf.LoadConfig(filename)
203 if err != nil {
204 return nil, nil, err
205 }
206
207 ctx, err := WithInstanceConfig(context.Background(), config, uuid.Nil)
208 if err != nil {
209 logrus.Fatalf("Error loading instance config: %+v", err)
210 }
211
212 db, err := storage.Dial(globalConfig)
213 if err != nil {
214 return nil, nil, err
215 }
216
217 return NewAPIWithVersion(ctx, globalConfig, db, version), config, nil
218}
219
220func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error {
221 return sendJSON(w, http.StatusOK, map[string]string{

Callers

nothing calls this directly

Calls 5

LoadGlobalFunction · 0.92
LoadConfigFunction · 0.92
DialFunction · 0.92
WithInstanceConfigFunction · 0.85
NewAPIWithVersionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…