TP-5555 | account provision
This commit is contained in:
@@ -49,6 +49,7 @@ type ExceptionValue struct {
|
||||
Extra interface{} `json:"extra,omitempty"`
|
||||
Request interface{} `json:"request,omitempty"`
|
||||
Contexts interface{} `json:"contexts,omitempty"`
|
||||
AwsAccount string `json:"aws_account,omitempty"`
|
||||
}
|
||||
|
||||
type Exception struct {
|
||||
@@ -86,14 +87,17 @@ func (exceptionService *ExceptionService) CatchErrors(c *gin.Context) {
|
||||
secret := c.Query("sentry_key")
|
||||
|
||||
var secretFromDb, found = exceptionService.inPodCacheClient.Get(projectID)
|
||||
var awsAccountFromDb, awsAccountFound = exceptionService.inPodCacheClient.Get(projectID + "_account")
|
||||
|
||||
//validate project id and secret is valid
|
||||
|
||||
if !found {
|
||||
if !found || !awsAccountFound {
|
||||
var projectData db.Project
|
||||
exceptionService.dbClient.First(&projectData, "project_reference_id = ?", projectID)
|
||||
secretFromDb = projectData.Secret
|
||||
awsAccountFromDb = projectData.Account
|
||||
exceptionService.inPodCacheClient.Set(projectID, secretFromDb)
|
||||
exceptionService.inPodCacheClient.Set(projectID+"_account", awsAccountFromDb)
|
||||
|
||||
}
|
||||
|
||||
@@ -130,6 +134,7 @@ func (exceptionService *ExceptionService) CatchErrors(c *gin.Context) {
|
||||
errorItem.Extra = jsonData.Extra
|
||||
errorItem.Request = jsonData.Request
|
||||
errorItem.Contexts = jsonData.Contexts
|
||||
errorItem.AwsAccount = awsAccountFromDb.(string)
|
||||
err := exceptionService.kafkaProducer.PublishEvent(errorItem, exceptionService.kafkaConfig.Topic, "", nil, encoder.JsonEncoderInstance)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user