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

Made get_remote_ip func swappable by exposing a new setting #1537

Conversation

arnav13081994
Copy link
Collaborator

@arnav13081994 arnav13081994 commented Jan 6, 2022

Please merge PR #1531 before merging this

Description

This PR contains the following changes:

  1. Exposed a new setting DJSTRIPE_GET_REMOTE_IP to allow the user to write their own function to extract the remote_ip from the request.
  2. Updated Application Code to accomodate the change
  3. Updated Corresponding Tests
  4. Updated docs with the new setting name.

Checklist:

  • I've updated the tests or confirm that my change doesn't require any updates.
  • I've updated the documentation or confirm that my change doesn't require any updates.
  • I confirm that my change doesn't drop code coverage below the current level.
  • I've updated migrations or confirm that my change doesn't make changes to any model.

Rationale

Fix: #1057
Fix: #1843
User would now be able to override _get_remote_ip with their own function for more advanced setups and perhaps even use libraries like django-ipware

@jleclanche
Copy link
Member

-1, this is not worth a new setting.

@arnav13081994
Copy link
Collaborator Author

@jleclanche How do you suggest we allow the user to handle customising the client_ip on their own as discussed here. There are quite a few edge cases that would need to be handled by dj-stripe then.

Renamed get_remote_ip() to _get_remote_ip() to avoid any confusion with the externally exposed setting
@jleclanche jleclanche closed this Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants