22 lines
665 B
Go
22 lines
665 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"knowledge-governance/internal/dobotaiops"
|
|
"knowledge-governance/internal/httpapi"
|
|
)
|
|
|
|
// A failed optional source must not replace or take down the main database.
|
|
func openQAOperations(ctx context.Context, getenv func(string) string, governanceDSN string) (httpapi.QAOpsReader, dobotaiops.Settings) {
|
|
settings := dobotaiops.LoadSettings(getenv, governanceDSN)
|
|
if !settings.Enabled || settings.Problem != "" {
|
|
return nil, settings
|
|
}
|
|
client, err := dobotaiops.Build(ctx, settings.Connection)
|
|
if err != nil {
|
|
settings.Problem = "source_connection_or_permissions_failed"
|
|
return nil, settings
|
|
}
|
|
return client, settings
|
|
}
|