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

Show warnings / errors for missing environment variables #39

Open
kenny-io opened this issue Oct 9, 2024 · 6 comments
Open

Show warnings / errors for missing environment variables #39

kenny-io opened this issue Oct 9, 2024 · 6 comments
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed

Comments

@kenny-io
Copy link
Contributor

kenny-io commented Oct 9, 2024

Currently, the installer script and entrypoint.sh don't provide clear feedback if required environment variables are missing. This can lead to silent failures or unexpected behavior that's difficult for users to troubleshoot.

Proposed Solution

  1. In the installer.sh script:

    • After creating the .env file, add a check to verify all required variables are set.
    • Display warnings for any missing variables.
  2. In the entrypoint.sh script:

    • At the beginning, add checks for critical environment variables.
    • Log warnings for any missing variables.
    • Optionally, exit with an error if critical variables are missing.

    Implementation Details

  • Create a function to check for the presence of environment variables

  • Use this function to check for important variables like:

    • DASHPASS
    • DASHPORT
    • EXT_IP
    • INT_IP
    • SHMEXT
    • SHMINT
    • minNodes
    • baselineNodes
    • nodesPerConsensusGroup

    Expected Outcome

Users should receive clear feedback about missing or invalid environment variables.

Mentorship

If you need any help or have questions about this issue feel free to ask in the comments. You can also start a discussion here on Github and our team will be happy to provide the necessary assistance.

@kenny-io kenny-io added good first issue Good for newcomers help wanted Extra attention is needed hacktoberfest labels Oct 9, 2024
@HTSagara
Copy link

HTSagara commented Oct 9, 2024

Hi, I would like to help in this issue

@HTSagara
Copy link

HTSagara commented Oct 9, 2024

I'm getting this error when installing it
Screenshot 2024-10-09 at 10 35 56 AM

@kenny-io
Copy link
Contributor Author

I'm getting this error when installing it Screenshot 2024-10-09 at 10 35 56 AM

@HTSagara The installer script doesn't support ARM64 machines just yet as the exit error suggests. An easy way to test the script is to use any VPS of your choice or a run it in a VM instance if you prefer. Here's a post on how to run the validator in a VM

@HTSagara
Copy link

Hi @kenny-io , thank you for sharing the post on how to run it.

I was able to implement the script to check if the variables are not set in the .env.

Screenshot 2024-10-10 at 4 50 08 PM Screenshot 2024-10-10 at 4 50 21 PM

However, can you give me a lead on how to check if they are valid or not?

@kenny-io
Copy link
Contributor Author

kenny-io commented Oct 11, 2024

@HTSagara great work on getting the variable check working!!

For the validity, I'm thinking you could add an addition step to confirm that when the variable is provided, it is valid.
The DASHPORT for instance, you could check that it is:

  • composed entirely of digits
  • greater than or equal to 1025
  • less than or equal to 65536
validate_port() {
    [[ "$1" =~ ^[0-9]+$ && "$1" -ge 1025 && "$1" -le 65536 ]]
}

Does this help give you some direction on next steps?

@HTSagara
Copy link

@kenny-io I created the PR explaining everything I did, can you kindly validate. Please let me know if there is anything you would like me to change.

#40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants