Skip to content

Commit

Permalink
Email is working
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony bible committed Nov 12, 2022
1 parent 1d414ae commit 143c988
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 8 additions & 10 deletions app/cmd/email/recieve.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ func (conf *Config) GetConn(rabbitUrl string) error {
}
ch, err := conn.Channel()
conf.Channel = ch
fmt.Printf("Creating connection: %+v", conf)
return err
}
func (conn Config) startConsumer(queueName string, handler func(conf Config, d amqp.Delivery) bool, concurrency int) {

fmt.Printf("queuename: %s\n", conn.RabQName)
defer conn.Channel.Close()
fmt.Printf("%+v", conn)
q, err := conn.Channel.QueueDeclare(
conn.RabQName, // name
true, // durable
Expand All @@ -46,9 +45,10 @@ func (conn Config) startConsumer(queueName string, handler func(conf Config, d a
false, // no-wait
nil, // arguments
)
defer conn.Channel.Close()
failOnError(err, "Failed to declare a queue")
err = conn.Channel.Qos(
100, //prefetch count
1, //prefetch count
0, //prefetch size
false, //global
)
Expand All @@ -63,11 +63,12 @@ func (conn Config) startConsumer(queueName string, handler func(conf Config, d a
nil, // args
)
failOnError(err, "Failed to register a consumer")

//var forever chan struct{}
var forever chan struct{}
for i := 0; i < concurrency; i++ {
go func() {
for msg := range msgs {
log.Info().Msg(string(msg.Body))
log.Info().Msg("recieved message")
// if tha handler returns true then ACK, else NACK
// the message back into the rabbit queue for
// another round of processing
Expand All @@ -82,7 +83,7 @@ func (conn Config) startConsumer(queueName string, handler func(conf Config, d a
}()
}
log.Printf(" [*] Waiting for messages. To exit press CTRL+C")

<-forever
}

func (conf Config) StartProcessing() {
Expand All @@ -91,10 +92,7 @@ func (conf Config) StartProcessing() {
if err != nil {
log.Fatal().Err(err)
}
fmt.Printf("Full config %+v", conf)
conf.startConsumer(conf.RabQName, handler, 100)
forever := make(chan bool)
<-forever

}
func handler(conf Config, d amqp.Delivery) bool {
Expand Down
6 changes: 4 additions & 2 deletions kubernetes/secrets.encrypted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ data:
PASSWORDEXCHANGE_EMAILPASS: ENC[AES256_GCM,data:+sCF4pXIQ0DMRbbfCLh73um1MrlYYN/XJWvFSHhdZJ1tD5fNeR6z4zZ7GIHzKYhk8drdp+pgPk/qcY/6,iv:SxAdervl03qSselq0PCsVVpRS29RXGTTMtKFfRxbdVs=,tag:PsBjfy/egxsphFNeEBOizQ==,type:str]
PASSWORDEXCHANGE_EMAILHOST: ENC[AES256_GCM,data:hQxijDV6mLE9norTJD2kax3YVCbLTABqi8GKWTHfRZ3L9aMluICHJr4HbIYk5njM,iv:ml/OAuG3RUwY1adFdjOnsKCT9gHNGv3xDkTjkWYwzeM=,tag:p1VEDE/0T3Mm5R0RvVPKqw==,type:str]
PASSWORDEXCHANGE_EMAILPORT: ENC[AES256_GCM,data:MGCLoA==,iv:dCHKeuZWdpXNCPohbG6M8NaETF9LSI84THM/rOGiv/g=,tag:GIpty/vJUAH2uC2XPhRetg==,type:str]
PASSWORDEXCHANGE_EMAILFROM: ENC[AES256_GCM,data:0Q02fYcuSU2kvzxQ7ff+RRionAIT7mPHR3QckhGFQXU=,iv:m3rkqJb+70QfoT49gZ2tJ6L1l6BqdQdmUPkEiQYMxGw=,tag:MzgdkK1yCZrxsrJZkNj8Tw==,type:str]
PASSWORDEXCHANGE_PRODHOST: ENC[AES256_GCM,data:AhmEV8ZUcD9y1vJ20RDLzYLxETcgdt580hZlEtSNetwg90qO,iv:V8PpaXtdKnX1n2kMu3WdtdpvOuAwiBdFJtWizsJVZNI=,tag:B1YzYy+pUPUL/M0iUgDOKw==,type:str]
PASSWORDEXCHANGE_DEVHOST: ENC[AES256_GCM,data:q998++c4l+s2RM34ObxAZt64WwVR7ZcwAaSBzG/skLPofBnoOtjyRg==,iv:j6zbnfn3c3IHAlKWXEUwGXzXtg52LnfQ7xj09JdID+A=,tag:qA79R2jaRYYhQa60Dld00Q==,type:str]
PASSWORDEXCHANGE_ENCRYPTIONPRODSERVICE: ENC[AES256_GCM,data:yza9ptsvaILVIqTCg+MB1TCNJi1nIT2YuCQ7E4feCjU=,iv:JWxZVFw7cxSIkd1EkkLDcRQknJvZkzYB74uTLWJVKBc=,tag:pug230Ad1ZmpiDZZWnPBDQ==,type:str]
Expand All @@ -22,6 +23,7 @@ data:
PASSWORDEXCHANGE_HCAPTCHA_SITEKEY: ENC[AES256_GCM,data:efO/OZrpcapA9LGHHlxdAKoGJL72B1n3gqNwIXCd+HNKnfN6Ei/ZVnn4sEQn3Kim,iv:NmN0caFkOISrZ2RsLnOd1/9w+EhlPpFb/D9XbHgUoXQ=,tag:GmzcgFsqeVcWrA9UdLdmPQ==,type:str]
PASSWORDEXCHANGE_RABPORT: ENC[AES256_GCM,data:kezIfRPHjNE=,iv:Vyr1fxX3MwfO7gomP2GG2jNBAlv7+qFDa9KiAUBhjfA=,tag:+YkD45xdD6X/RRd+6WxGZg==,type:str]
PASSWORDEXCHANGE_RABHOST: ENC[AES256_GCM,data:YFgYGz+nXqJfbxqT70n2dQ==,iv:+LxYP4JBd8GOJ0qDmhVCv2+Bd1twhspWpjXbTlCMF5E=,tag:3ZqkFlzG4xp737tQj4qvzQ==,type:str]
PASSWORDEXCHANGE_RABQNAME: ENC[AES256_GCM,data:FnHcfNWeY6I=,iv:9h4ZHD816pNXv4b/cDGp1c/9qVnj5ZlC//uiWHKUd60=,tag:p8v7wO9bNe4sRbCFxEJThA==,type:str]
PASSWORDEXCHANGE_RABUSER: ENC[AES256_GCM,data:HcgNGP0QVY0=,iv:qeO69j2oYFtNjqR5orDh+OIW0sKEgS0JukZbUEY/eAk=,tag:ITnaeRDLlfuPqnEJyYKHMg==,type:str]
PASSWORDEXCHANGE_RABPASS: ENC[AES256_GCM,data:cB9bmk5gWlw=,iv:GiAOMeXdIDXTRjQiI/Q9jDUButmm7tuJeZIhNha1oRg=,tag:ePCloHnm4Uz74wQartjozQ==,type:str]
OAUTHDB_PASSWORD: ENC[AES256_GCM,data:lSPN2WXziBCnUoZelyIZMeKfN/ZKMyDN,iv:lDIhSPbVH2MF5giNQkBJ9dMfLJzdV7rcDFNwFPsTMAY=,tag:WMhpkn+Mhj4VVHhurgEZCg==,type:str]
Expand All @@ -43,8 +45,8 @@ sops:
azure_kv: []
hc_vault: []
age: []
lastmodified: "2022-11-11T03:01:12Z"
mac: ENC[AES256_GCM,data:SlQMaeRRAe0Lu2hwqTJPYMJaD9gQsZBdt2UKDEk3AkjlCMPLIABMFwKi7r6YxH7ShuzIOfVoX4zvFRmgj/BFUdUPLNHT33ENHHRFAR6pCczlMiAx+Tkt2YlE2AOBsRATUAIdRclprTtk3t/IedFhHWL3mjcmXuL8edQTa+jydGA=,iv:QGy23HZ1BIxvB3pjmhIkFNv4t/J/e1RbIZA9QuNjlaM=,tag:P/TcbdhDLqv06O7vfKExRw==,type:str]
lastmodified: "2022-11-12T05:40:22Z"
mac: ENC[AES256_GCM,data:V8pQ0U2XBXfT3JS7a0qqFii/7zbGrNotv57nYaqKzE1enew9pQ47BBnTLUfCb2Ux7kSfbH0Sp/1TbgB8QFVnnM5cd/GpO7wcFkpQ0tnaPeQ0wG04nzOpGK+40mI110SJZAe5MASdNJpMjbaVwJkeFEt/cKIbia4XCkwaVBRgEh8=,iv:DCpOFQidOcpX6YT5xkAJ/paJFEt4H1/n7iiJJJLyLSU=,tag:FTZeBpds/zkgv/SKxMX72g==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.7.3

0 comments on commit 143c988

Please sign in to comment.