Sh4yy / cloudflare-email

This is a simple proxy server that can be used for sending free transactional emails through Cloudflare workers.
MIT License
1.45k stars 338 forks source link

Suggesting using Secrets instead #2

Closed benguild closed 1 year ago

benguild commented 1 year ago

1

Sh4yy commented 1 year ago

Thanks for looking into this! I find setting up env variables much easier and straightforward, specifically when doing local development and deploying without using Wranger. I'd say a better solution would be supporting both but giving a higher priority to secrets so it is used if set. Otherwise, we default back to env variables.

Happy to implement it tomorrow morning!

benguild commented 1 year ago

It's just a README change. Deploying a secret with the same name works the same way but doesn't store it in the file, which risks it being accidentally committed to the repo.

Sh4yy commented 1 year ago

I apologize! You are right!

Two things before I merge,

  1. We still need [env.production] in the toml file. I currently get this warning:

    - No environment found in configuration with name "production".
      Before using `--env=production` there should be an equivalent environment section in
    the configuration.
    
      Consider adding an environment configuration section to the wrangler.toml file:

    [env.production]

  2. Also, I think this would be a better description for the third step:

Use the command npx wranler secret put --env production TOKEN to create a secure token. You are then prompted to enter a random secret value. This will be used to authenticate your requests. You can also set this value directly in your Cloudflare dashboard.

benguild commented 1 year ago

I'll tweak it right now, hang on

benguild commented 1 year ago

pushed 26aa4bcc2f0514f06221fcefe2a1c24cd854d5ca

Sh4yy commented 1 year ago

Merged! Thank you.