MCPcopy
hub / github.com/daptin/daptin / GetConfigValueFor

Method GetConfigValueFor

server/resource/cms_config.go:178–202  ·  view source on GitHub ↗
(key string, configtype string, transaction *sqlx.Tx)

Source from the content-addressed store, hash-verified

176}
177
178func (configStore *ConfigStore) GetConfigValueFor(key string, configtype string, transaction *sqlx.Tx) (string, error) {
179 var val interface{}
180
181 s, v, err := statementbuilder.Squirrel.Select("value").
182 From(settingsTableName).Prepared(true).
183 Where(goqu.Ex{"name": key}).
184 Where(goqu.Ex{"configstate": "enabled"}).
185 Where(goqu.Ex{"configenv": configStore.defaultEnv}).
186 Where(goqu.Ex{"configtype": configtype}).ToSQL()
187
188 CheckErr(err, "[180] failed to create config select query")
189
190 stmt1, err := transaction.Preparex(s)
191 if err != nil {
192 log.Errorf("[186] failed to prepare statment [%s]: %v", s, err)
193 return "", err
194 }
195 defer stmt1.Close()
196 err = stmt1.QueryRowx(v...).Scan(&val)
197 if err != nil {
198 log.Printf("[198] No config value set for [%v]: %v", key, err)
199 return "", err
200 }
201 return fmt.Sprintf("%s", val), err
202}
203
204func (configStore *ConfigStore) GetConfigValueForWithTransaction(key string, configtype string, transaction *sqlx.Tx) (string, error) {
205 var val interface{}

Callers 15

mainFunction · 0.95
MainFunction · 0.95
NewLanguageMiddlewareFunction · 0.80
InitializeImapResourcesFunction · 0.80
resolveIMAPHostnameFunction · 0.80
oauthAuthorizeHandlerFunction · 0.80
DaptinSmtpDbResourceFunction · 0.80
CheckSystemSecretsFunction · 0.80
StartSMTPMailServerFunction · 0.80
InitializeFtpResourcesFunction · 0.80
llmMeteringConfigFunction · 0.80
CreateConfigHandlerFunction · 0.80

Calls 6

ScanMethod · 0.80
QueryRowxMethod · 0.80
CheckErrFunction · 0.70
SelectMethod · 0.65
PreparexMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected