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

Ability to provide a lookup table to fetch the remote address. #13

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Ability to provide a lookup table to fetch the remote address. #13

merged 2 commits into from
Jan 21, 2020

Conversation

amandiobm
Copy link
Contributor

Related to issue #8

@jamesmills & @ridz1208 I did some initial implementation on that issue, please take a look and feel free to add comments, commits, etc. ;)

I initially thought of creating a lookup table so we can search in whatever attribute inside the request helper, by any key. Having in mind when the key is found inside the attribute, that key will be used.

@amandiobm amandiobm changed the title Ability to change the default format. Ability to provide a lookup table to fetch the remote address. Jan 16, 2020
@jamesmills
Copy link
Owner

Hi @amandiobm!

Thank you for this suggested solution to the initial issue (#8) which @ridz1208 submitted.

This solution is much more thorough than the one I was going to suggest so thank you for this and awsome work.

I don't see anything that would need changing for it to be merged.

Once you have updated the README I would be happy to merge, tag and push this to the world!

Thank you.

@amandiobm
Copy link
Contributor Author

Neat. I still need to update the README, the config description, a double-check, and we're all good ;)

It would be nice to hear from @ridz1208 if that approach would help him.

See you soon, and is always a pleasure ;)

@amandiobm
Copy link
Contributor Author

I think we're all done @jamesmills . take a look.

Copy link

@ridz1208 ridz1208 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me just start with THIS IS GREAT !!

Thank you @amandiobm and @jamesmills for working on this that quickly, I didn't even have a chance to dive into it.

As for the changes themselves. I think it would definitely work. If I understand correctly you can define a set of headers in which you expect to find the real IP and the code then reads through them and as soon as 1 IP is found it will automatically be used.

README.md Outdated
@@ -118,6 +118,10 @@ By default, the timezone will be overwritten at each login with the current user

By default, the date format will be `jS F Y g:i:a`. To override this configuration, you just need to change the `format` property inside the configuration file `config/timezone.php` for the desired format.

### Lookup Array

this lookup array configuration makes it possible to find the remote address of the user in any attribute inside the Laravel `request` helper, by any key. Having in mind when the key is found inside the attribute, that key will be used. By default, we use the `server` attribute with the key `REMOTE_ADDR`. To override this configuration, you just need to change the `lookup` property inside the configuration file `config/timezone.php` for the desired lookup.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should start with an uppercase letter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Tks.

Copy link
Contributor Author

@amandiobm amandiobm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for the changes themselves. I think it would definitely work. If I understand correctly you can define a set of headers in which you expect to find the real IP and the code then reads through them and as soon as 1 IP is found it will automatically be used.

I wouldn't say 1st IP. It will search for the key inside the attribute. Once it's found, it will be used.

Maybe we are talking about the same thing using different wording hehe.

@amandiobm
Copy link
Contributor Author

Hey @jamesmills any follow-up?

@jamesmills
Copy link
Owner

Hi!

Looks great, I will look at the PR when I am in the office tomorrow and update the changelog and tag a new release.

Thank you for your continued support!

James

@jamesmills jamesmills merged commit 8a2b70f into jamesmills:master Jan 21, 2020
@jamesmills
Copy link
Owner

Done. Thanks again.

@amandiobm amandiobm deleted the issue-8 branch January 23, 2020 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants