Uploaded image for project: 'Hybrid Cloud Console'
  1. Hybrid Cloud Console
  2. RHCLOUD-32723

Add environment variable to BOP and check it in sendmail endpoint

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Unset
    • No
    • 2
    • Access & Management Sprint 88

      with SMTP implemetation 

      this curl is not falling

       

      curl -X POST "http://localhost:8083/v1/sendEmails" \
      -H "x-rh-insights-env:XXXX" \
      -H "x-rh-clientid:super-client" \
      -H "x-rh-apitoken:root1234" \
      -H 'content-type: application/json' \
      -d '{"emails":[

      {"subject":"email subject", "body":"email body", "recipients":["lpichler@redhat.com"], "bodyType":"text"}

      ] }'

       

      x-rh-insights-env is used to determine whether BOP should take stage or production IT service url.

      Stage or Production host  for SMTP environment variables are populated based on pipeline config files here:

      stage

      https://gitlab.cee.redhat.com/insights-platform/backoffice-proxy-pipeline/-/blob/master/src/main/config/preprod?ref_type=heads

      production 

      https://gitlab.cee.redhat.com/insights-platform/backoffice-proxy-pipeline/-/blob/master/src/main/config/prod?ref_type=heads

      so previous mechanism is not needed.

       

      We need to add new env variable into BOP which determines environment

      ENVIRONMENT=stage or production

      and add into v1/sendEmail check which will validate 

      whether 

      x-rh-insights-env header is set correctly (header['x-rh-insights-env'] == ENV['ENVIRONMENT'] )

       

      it was falling previously because it was trying to connect for production email service with stage authentication.

       

       

       

              lpichler@redhat.com Libor Pichler
              lpichler@redhat.com Libor Pichler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: