-
Notifications
You must be signed in to change notification settings - Fork 53
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
spads_controller get_rating not testable when running on Windows WSL #346
Comments
|
You can remove it for local tests. |
Can I just add a config to dev.exs e.g. devmode: true and then check for it?
|
Which IP do local SPADS have? |
I'm wary of adding checks in the code for dev mode, it tends to lead to more convoluted code. If you want to test something you can modify the code locally. If that becomes a bigger problem, we'll need a better solution. |
It's there so that in production, outside sources cannot call that endpoint. In production SPADS and teiserver have the same IP. Modifying that code when developing requires you to know that code even exists and that you're supposed to change it when developing. If I modify it every time I develop, it could easily be committed by mistake too. |
No, If this is meant as an access control measure, we should return an error like 401/403 not some bogus stuff. |
Yeah it's really weird it returns a bogus rating instead of an error. |
What is the desired outcome? I recently worked on this in #512 (see, specifically https://github.com/beyond-all-reason/teiserver/pull/512/files#diff-f81da668c2dd87337f72b9a3a7b16599378313c1380d5641ae2d05eca1fc0dabR232) and can reuse some of that code to close this issue. There are two issues I can see
Perhaps I can try to fix it on WSL and close this issue? |
If you can make it work on WSL that would be preferred. Somehow get this |
II think @geekingfrog has the best solution. |
Alternatively, maybe a site config could be used which would disable the IP check and allow anyone to get ratings, it could then be changed locally or even on integration server temporarily if needed, however even with this solution a proper error should still be returned if this option is disabled. |
This would cover all bases. |
spads_controller get_rating has this
When on Windows WSL, the host_ip and conn_ip will not match and therefore you will always get the Duel rating. I have no idea what that check is for but I think it should be removed. Otherwise it is impossible to locally test anything that interacts with the rating endpoint
The text was updated successfully, but these errors were encountered: