-
Notifications
You must be signed in to change notification settings - Fork 170
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
namespace all apicast source code #486
Conversation
* to not have too many things named apicast * because that directory will include another apicast folder with lua sources * `apicast/apicast/src/apicast` would look really silly
* all related files to the cli should be in `apicast/cli`
73e7c53
to
1ce43dc
Compare
so we don't pollute global namespace with files and prevent clashes when new dependencies are installed
this is going to be a breaking change for policies that previously required apicast policy
1ce43dc
to
acb0fba
Compare
@@ -0,0 +1,51 @@ | |||
local loadfile = loadfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think It would be good to document the purpose of this module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, good point :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed in b1d677a.
acb0fba
to
109e5cb
Compare
t/deprecation-warnings.t
Outdated
|
||
__DATA__ | ||
|
||
=== TEST 1: authentication credentials missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd change the title and description of the test so they make reference to what is actually being tested here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hah, yeah my copy paste issue
well spotted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit scary, but looks good. 👍
* custom loader can try to load files from new paths even when the caller code refers to the old ones * print deprecation warnings with suggestions how to fix them
* makes it way easier in tests to not stub upstream
109e5cb
to
a12a22c
Compare
tl;dr
From now instead of
require('policy')
userequire('apicast.policy')
. All APIcast source code is in theapicast
namespace.Right now APIcast is polluting global namespace with its source files.
As more dependencies are installed there is higher chance of a clash.
So we need to namespace all APIcast source code in
apicast
folder insidethe Lua load path.
To prevent weird paths like
apicast/apicast/src/apicast
this also renames thefolder that contains all APIcast distributed source from
apicast
togateway
.Print deprecation warnings when old code refers to new paths:
Please note the benchmark does not work because the new configuration is not compatible with the old one. But the old one should be compatible with the new one.
Also note that if someone was overriding a path of APIcast then it will stop working after this change.
Requiring old files continue to work with a deprecation warning, but overriding those files on old paths
will not be taken into effect in the APIcast codebase. This is potential BREAKING CHANGE for some customizations.
Another interesting change is the echo policy. Now it short circuits the upstream api and responds directly in the rewrite phase stopping everything else.
/cc @3scale/support