-
Notifications
You must be signed in to change notification settings - Fork 3
feat: update to new serverless gateway #111
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
Conversation
2e87677
to
14b8661
Compare
12e1c60
to
2cc1014
Compare
) | ||
raise RuntimeError("scwgw is not installed") | ||
|
||
self.cli = cli |
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.
Initially, I wanted to run scwgw check
here to fail fast if the gateway container were not ready, but the problem was that env vars are not properly passed to the subprocess (intended behavior to avoid security issues) and that output parsing was a bit ugly.
What do you think?
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's ok to assume the gateway has to be fully set up and working before using this framework. Having checks running in here is mixing responsibilities, so I'm happy not to include it.
from scw_serverless.config.route import GatewayRoute | ||
|
||
|
||
class Gateway(Protocol): |
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.
Might be a bit anti YAGMI to use a protocol when we have a single implementation, it's only useful for the unit tess.
@@ -33,12 +33,3 @@ def validate(self) -> None: | |||
for method in self.http_methods or []: | |||
if method not in HTTPMethod: | |||
raise RuntimeError(f"Route contains invalid method {method.value}") | |||
|
|||
def asdict(self) -> dict[str, Any]: |
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.
This only is highly dependent of the gateway, so I prefer to have it in the gateway part of the code. It's what we do the other config options.
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.
Nice work, LGTM 👍
) | ||
raise RuntimeError("scwgw is not installed") | ||
|
||
self.cli = cli |
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's ok to assume the gateway has to be fully set up and working before using this framework. Having checks running in here is mixing responsibilities, so I'm happy not to include it.
Summary
What's changed?
Why do we need this?
How have you tested it?
Checklist
Details
scwgw
CLI in subprocesses.