NewAPIFromConfigFile creates a new REST API using the provided configuration file.
(filename string, version string)
| 194 | |
| 195 | // NewAPIFromConfigFile creates a new REST API using the provided configuration file. |
| 196 | func 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 | |
| 220 | func (a *API) HealthCheck(w http.ResponseWriter, r *http.Request) error { |
| 221 | return sendJSON(w, http.StatusOK, map[string]string{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…