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

feat: convert public ip to json #4332

Merged
merged 7 commits into from
Oct 8, 2023
Merged

feat: convert public ip to json #4332

merged 7 commits into from
Oct 8, 2023

Conversation

dgibbs64
Copy link
Member

@dgibbs64 dgibbs64 commented Oct 8, 2023

Description

updated the public ip provider to http://ip-api.com.json that can provide more detail about a servers public ip. This will allow alerts to in future provide more details

Fixes #[issue]

Type of change

  • Bug fix (a change which fixes an issue).
  • New feature (a change which adds functionality).
  • New Server (new server added).
  • Refactor (restructures existing code).
  • Comment update (typo, spelling, explanation, examples, etc).

Checklist

PR will not be merged until all steps are complete.

  • This pull request links to an issue.
  • This pull request uses the develop branch as its base.
  • This pull request subject follows the Conventional Commits standard.
  • This code follows the style guidelines of this project.
  • I have performed a self-review of my code.
  • I have checked that this code is commented where required.
  • I have provided a detailed enough description of this PR.
  • I have checked if documentation needs updating.

Documentation

If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.

Thank you for your Pull Request!

dgibbs64 and others added 7 commits October 8, 2023 00:20
The code in `info_game.sh` has been refactored to enhance the process of retrieving and handling the public IP address. The changes include:
- Using the API endpoint `http://ip-api.com/json/` instead of `https://api.ipify.org`
- Storing the retrieved data in `publicip.txt`
- Extracting additional information such as country and country code using `jq`

These improvements aim to provide more accurate and detailed information about the public IP address.
…y, and country code

The commit refactors the code by updating the API URL to remove a trailing slash. Additionally, it sets default values for the variables `publicip`, `country`, and `countrycode` when the file `${tmpdir}/publicip.txt` is not found.
This commit adds functionality to cache the public IP address for 24 hours. If the cached IP address is older than 24 hours or doesn't exist, a new request is made to retrieve the public IP address. The retrieved IP address is then stored in a file for future use. Additionally, if there are any errors during the retrieval process, appropriate warning messages are logged and default values are set for the IP address, country, and country code.

Co-authored-by: AI Assistant <[email protected]>
This commit adds functionality to cache the public IP address for 24 hours. If the cached IP address is older than 24 hours or doesn't exist, a new request is made to retrieve the public IP address. The retrieved IP address is then stored in a file for future use. Additionally, if there are any errors during the retrieval process, appropriate warning messages are logged and default values are set for the IP address, country, and country code.
The code has been refactored to use a JSON file instead of a text file for caching the public IP address. The log messages have also been updated to provide more informative output.
This commit refactors the `info_messages.sh` module by removing the Mailgun (email) alert functionality. The code changes remove the corresponding section that displays the Mailgun alert status in the info message script. This change simplifies and streamlines the code by eliminating unused functionality.
@dgibbs64 dgibbs64 added this to the v23.6.0 milestone Oct 8, 2023
@dgibbs64 dgibbs64 merged commit 08a8da2 into develop Oct 8, 2023
21 of 148 checks passed
@dgibbs64 dgibbs64 deleted the feature/public-ip branch October 8, 2023 19:08
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant