Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify .env configurations on start #37

Open
mpuckett159 opened this issue Oct 10, 2020 · 1 comment
Open

Verify .env configurations on start #37

mpuckett159 opened this issue Oct 10, 2020 · 1 comment
Labels
component:build enhancement New feature or request good first issue Good for newcomers

Comments

@mpuckett159
Copy link
Contributor

mpuckett159 commented Oct 10, 2020

Description

This is more of a stylistic preference I think, and just kind of a "maybe this is a good idea" thought I guess, feel free to reject or amend it. I was thinking it might be good to include some validations in the env.py file similar to the castings we're doing. This way the admin can see immediately if there are issues with the .env file settings.

Verify various configuration values in the .env file including:

  • Signal contacts/numbers
    • BOT_NUMBER - verify registration to allow sending
    • ADMIN_CONTACT - move heuristics from signal.py send_message() function to the env loading, verify existence and right to send
    • LISTEN_CONTACT - move heuristics from signal.py send_message() function to the env loading, verify existence and right to send
    • Add a ADMIN_CONTACT_TYPE and LISTEN_CONTACT_TYPE to support moving the heuristics out of signal and into the env file.
  • Various Twitter API access tokens - verify they work as expected
    • TWITTER_API_KEY
    • TWITTER_API_SECRET
    • TWITTER_ACCESS_TOKEN
    • TWITTER_TOKEN_SECRET
  • TRUSTED_TWEETERS - check for formatting ie. no @ at the beginning of the username, maybe just warn and strip instead of fail
  • Hashtag lists - check that hashtags start with #, maybe just warn and add the # if it doesn't exist
    • SEND_HASHTAGS
    • RECEIVE_HASHTAGS
  • AUTOSCAN_STATE_FILE_PATH:
    • check if the path is a relative path to the application directory
    • check if the path is within a mounted volume to ensure statefulness but probably only throw a warning if it isn't since it isn't really that big a deal
    • more things I'm sure
@mpuckett159 mpuckett159 added the enhancement New feature or request label Oct 10, 2020
@AetherUnbound
Copy link
Collaborator

I dig this!! I think it would be helpful to have it as a separate command, since some of these checks could be time consuming and we may not want it to run on every startup. But definitely a more thorough validation check could really help in getting an instance going.

@AetherUnbound AetherUnbound added the good first issue Good for newcomers label Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:build enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants