Python Forum
Email Security with SendGrid - what are the risks?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email Security with SendGrid - what are the risks?
#3
Normally, code is stored in version control repositories. So things like api keys, database passwords, etc you don't want in the code, because you don't want it visible in the repository. Instead, you'd have a config file outside the repository, that you then load and use. json is built into python, so something like:
import json

config = {}
with open("../../config.json") as f:
    config = json.load(f)

sendgrid_api_key = config["sendgrid_api_key"]
And your config file would look something like:
{
  "sendgrid_api_key": "asdf234asdfew",
  "email_from_address": "[email protected]"
}
Then the config file would be backed up in a secure place, outside the code storage, where only a few people have access. Perhaps a "secrets" bucket on aws s3, for example.
Reply


Messages In This Thread
RE: Email Security with SendGrid - what are the risks? - by nilamo - Aug-01-2020, 06:07 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020