mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated check for poster configuration
This commit is contained in:
committed by
Dan Christian Bogos
parent
65b0e0f608
commit
a36c914aa7
@@ -1593,6 +1593,8 @@ func main() {
|
||||
}
|
||||
utils.Logger.SetLogLevel(lgLevel)
|
||||
|
||||
cfg.LazzySanityCheck()
|
||||
|
||||
var loadDb engine.LoadStorage
|
||||
var cdrDb engine.CdrStorage
|
||||
var dm *engine.DataManager
|
||||
|
||||
@@ -395,20 +395,8 @@ func (self *CGRConfig) checkConfigSanity() error {
|
||||
}
|
||||
}
|
||||
for _, cdrePrfl := range self.cdrsCfg.CDRSOnlineCDRExports {
|
||||
if cdreProfile, hasIt := self.CdreProfiles[cdrePrfl]; !hasIt {
|
||||
if _, hasIt := self.CdreProfiles[cdrePrfl]; !hasIt {
|
||||
return fmt.Errorf("<CDRS> Cannot find CDR export template with ID: <%s>", cdrePrfl)
|
||||
} else if cdreProfile.ExportFormat == utils.MetaS3jsonMap || cdreProfile.ExportFormat == utils.MetaSQSjsonMap {
|
||||
poster := "SQSPoster"
|
||||
if cdreProfile.ExportFormat == utils.MetaS3jsonMap {
|
||||
poster = "S3Poster"
|
||||
}
|
||||
neededArgs := []string{"aws_region", "aws_key", "aws_secret"}
|
||||
args := utils.GetUrlRawArguments(cdreProfile.ExportPath)
|
||||
for _, arg := range neededArgs {
|
||||
if _, has := args[arg]; !has {
|
||||
utils.Logger.Err(fmt.Sprintf("<%s> No %s present for AWS for cdre: <%s>.", poster, arg, cdrePrfl))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !self.thresholdSCfg.Enabled {
|
||||
@@ -721,6 +709,23 @@ func (self *CGRConfig) checkConfigSanity() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CGRConfig) LazzySanityCheck() {
|
||||
for _, cdrePrfl := range self.cdrsCfg.CDRSOnlineCDRExports {
|
||||
if cdreProfile, hasIt := self.CdreProfiles[cdrePrfl]; hasIt && (cdreProfile.ExportFormat == utils.MetaS3jsonMap || cdreProfile.ExportFormat == utils.MetaSQSjsonMap) {
|
||||
poster := utils.SQSPoster
|
||||
if cdreProfile.ExportFormat == utils.MetaS3jsonMap {
|
||||
poster = utils.S3Poster
|
||||
}
|
||||
argsMap := utils.GetUrlRawArguments(cdreProfile.ExportPath)
|
||||
for _, arg := range []string{utils.AWSRegion, utils.AWSKey, utils.AWSSecret} {
|
||||
if _, has := argsMap[arg]; !has {
|
||||
utils.Logger.Warning(fmt.Sprintf("<%s> No %s present for AWS for cdre: <%s>.", poster, arg, cdrePrfl))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Loads from json configuration object, will be used for defaults, config from file and reload, might need lock
|
||||
func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) (err error) {
|
||||
// Load sections out of JSON config, stop on error
|
||||
|
||||
@@ -1096,6 +1096,7 @@ func resetAccount(ub *Account, action *Action, acts Actions, _ interface{}) erro
|
||||
filter := &utils.CDRsFilter{
|
||||
NotRunIDs: []string{utils.MetaRaw},
|
||||
Accounts: []string{account},
|
||||
NotCosts: []float64{-1},
|
||||
OrderBy: fmt.Sprintf("%s%sdesc", utils.OrderID, utils.INFIELD_SEP),
|
||||
Paginator: utils.Paginator{Limit: utils.IntPointer(1)},
|
||||
}
|
||||
|
||||
@@ -39,11 +39,10 @@ const (
|
||||
exchangeType = "exchange_type"
|
||||
routingKey = "routing_key"
|
||||
|
||||
awsRegion = "aws_region"
|
||||
awsID = "aws_key"
|
||||
awsSecret = "aws_secret"
|
||||
awsToken = "aws_token"
|
||||
// awsAccountID = "aws_account_id"
|
||||
//awsRegion = "aws_region"
|
||||
//awsID = "aws_key"
|
||||
//awsSecret = "aws_secret"
|
||||
awsToken = "aws_token"
|
||||
folderPath = "folder_path"
|
||||
)
|
||||
|
||||
|
||||
@@ -69,13 +69,13 @@ func (pstr *S3Poster) parseURL(dialURL string) {
|
||||
if val, has := qry[folderPath]; has {
|
||||
pstr.folderPath = val
|
||||
}
|
||||
if val, has := qry[awsRegion]; has {
|
||||
if val, has := qry[utils.AWSRegion]; has {
|
||||
pstr.awsRegion = val
|
||||
}
|
||||
if val, has := qry[awsID]; has {
|
||||
if val, has := qry[utils.AWSKey]; has {
|
||||
pstr.awsID = val
|
||||
}
|
||||
if val, has := qry[awsSecret]; has {
|
||||
if val, has := qry[utils.AWSSecret]; has {
|
||||
pstr.awsKey = val
|
||||
}
|
||||
if val, has := qry[awsToken]; has {
|
||||
|
||||
@@ -67,13 +67,13 @@ func (pstr *SQSPoster) parseURL(dialURL string) {
|
||||
if val, has := qry[queueID]; has {
|
||||
pstr.queueID = val
|
||||
}
|
||||
if val, has := qry[awsRegion]; has {
|
||||
if val, has := qry[utils.AWSRegion]; has {
|
||||
pstr.awsRegion = val
|
||||
}
|
||||
if val, has := qry[awsID]; has {
|
||||
if val, has := qry[utils.AWSKey]; has {
|
||||
pstr.awsID = val
|
||||
}
|
||||
if val, has := qry[awsSecret]; has {
|
||||
if val, has := qry[utils.AWSSecret]; has {
|
||||
pstr.awsKey = val
|
||||
}
|
||||
if val, has := qry[awsToken]; has {
|
||||
|
||||
@@ -172,7 +172,7 @@ func TestRPCITLclStatusFirstFailback(t *testing.T) {
|
||||
// Make sure it executes on the first node supporting the command
|
||||
func TestRPCITLclTDirectedRPC(t *testing.T) {
|
||||
var sessions []*sessions.ExternalSession
|
||||
if err := rpcPoolFirst.Call(utils.SessionSv1GetActiveSessions, nil, &sessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
if err := rpcPoolFirst.Call(utils.SessionSv1GetActiveSessions, utils.SessionFilter{}, &sessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1118,6 +1118,15 @@ const (
|
||||
HTTPAgent = "HTTPAgent"
|
||||
)
|
||||
|
||||
// Poster
|
||||
const (
|
||||
SQSPoster = "SQSPoster"
|
||||
S3Poster = "S3Poster"
|
||||
AWSRegion = "aws_region"
|
||||
AWSKey = "aws_key"
|
||||
AWSSecret = "aws_secret"
|
||||
)
|
||||
|
||||
func buildCacheInstRevPrefixes() {
|
||||
CachePrefixToInstance = make(map[string]string)
|
||||
for k, v := range CacheInstanceToPrefix {
|
||||
|
||||
Reference in New Issue
Block a user