-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix egregious indentation issues #1620
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
base: main
Are you sure you want to change the base?
Changes from all commits
0ea25bd
4bbd6a2
08b852a
1cb4748
eef8d69
b3dbc6f
d68f5ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,17 +86,17 @@ First, create a new file called `traffic-policy.yml` in the root of your project | |
|
||
```yaml policy.yml | ||
on_http_request: | ||
- name: OAuth | ||
- name: OAuth | ||
actions: | ||
- type: oauth | ||
- type: oauth | ||
config: | ||
auth_id: oauth | ||
provider: google | ||
- name: bad email | ||
- name: bad email | ||
expressions: | ||
- actions.ngrok.oauth.identity.email != '[email protected]' | ||
actions: | ||
- type: custom-response | ||
- type: custom-response | ||
config: | ||
body: Hey, no auth for you ${actions.ngrok.oauth.identity.name}! | ||
status_code: 400 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,16 +19,16 @@ This rule: | |
|
||
```yaml policy.yml | ||
on_http_request: | ||
- expressions: | ||
- expressions: | ||
- rand.double() <= 0.5 | ||
actions: | ||
- type: forward-internal | ||
- type: forward-internal | ||
config: | ||
url: https://a.internal | ||
- actions: | ||
- type: forward-internal | ||
config: | ||
url: https://b.internal | ||
- actions: | ||
- type: forward-internal | ||
config: | ||
url: https://b.internal | ||
Comment on lines
+28
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we remove the YAML formatter check, we need to start being careful that we're using spaces for indentation, not tabs. This policy doesn't work if you paste it into a cloud endpoint because of the tabs. |
||
``` | ||
|
||
```json policy.json | ||
|
@@ -77,15 +77,15 @@ You can also send the traffic to a different route using url rewrites. | |
|
||
```yaml policy.yml | ||
on_http_request: | ||
- expressions: | ||
- expressions: | ||
- rand.double() <= 0.5 | ||
actions: | ||
- type: url-rewrite | ||
- type: url-rewrite | ||
config: | ||
from: /path/to/test | ||
to: /path/to/test-b | ||
- actions: | ||
- type: forward-internal | ||
- actions: | ||
- type: forward-internal | ||
config: | ||
url: https://b.internal | ||
``` | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,27 +14,27 @@ This rule adds key-based rate limiting to your endpoints based on your consumers | |||||||||||||
on_http_request: | ||||||||||||||
- name: Add JWT authentication and rate limiting | ||||||||||||||
actions: | ||||||||||||||
- type: rate-limit | ||||||||||||||
- type: rate-limit | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
config: | ||||||||||||||
name: Only allow 30 requests per minute | ||||||||||||||
name: Only allow 30 requests per minute | ||||||||||||||
algorithm: sliding_window | ||||||||||||||
capacity: 30 | ||||||||||||||
rate: 60s | ||||||||||||||
bucket_key: | ||||||||||||||
- req.headers['x-api-key'] | ||||||||||||||
- type: jwt-validation | ||||||||||||||
- type: jwt-validation | ||||||||||||||
config: | ||||||||||||||
issuer: | ||||||||||||||
issuer: | ||||||||||||||
allow_list: | ||||||||||||||
- value: https://<YOUR-AUTH-PROVIDER> | ||||||||||||||
audience: | ||||||||||||||
allow_list: | ||||||||||||||
- value: <YOUR-NGROK-DOMAIN> | ||||||||||||||
http: | ||||||||||||||
tokens: | ||||||||||||||
tokens: | ||||||||||||||
- type: jwt | ||||||||||||||
method: header | ||||||||||||||
name: Authorization | ||||||||||||||
name: Authorization | ||||||||||||||
prefix: Bearer | ||||||||||||||
jws: | ||||||||||||||
allowed_algorithms: | ||||||||||||||
|
@@ -130,25 +130,25 @@ This rule grants conditional access to a page using the following ngrok [OAuth a | |||||||||||||
on_http_request: | ||||||||||||||
- name: OAuth | ||||||||||||||
actions: | ||||||||||||||
- type: oauth | ||||||||||||||
- type: oauth | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be indented more, and then so does everything else nested beneath it.
Suggested change
|
||||||||||||||
config: | ||||||||||||||
auth_id: oauth | ||||||||||||||
auth_id: oauth | ||||||||||||||
provider: google | ||||||||||||||
- name: good email | ||||||||||||||
- name: good email | ||||||||||||||
expressions: | ||||||||||||||
- actions.ngrok.oauth.identity.email.endsWith('@ngrok.com') | ||||||||||||||
- actions.ngrok.oauth.identity.email.endsWith('@ngrok.com') | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs to be indented more.
Suggested change
|
||||||||||||||
actions: | ||||||||||||||
- type: custom-response | ||||||||||||||
config: | ||||||||||||||
body: Welcome ${actions.ngrok.oauth.identity.name}! | ||||||||||||||
body: Welcome ${actions.ngrok.oauth.identity.name}! | ||||||||||||||
status_code: 200 | ||||||||||||||
- name: bad email | ||||||||||||||
- name: bad email | ||||||||||||||
expressions: | ||||||||||||||
- !actions.ngrok.oauth.identity.email.endsWith('@ngrok.com') | ||||||||||||||
- !actions.ngrok.oauth.identity.email.endsWith('@ngrok.com') | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
actions: | ||||||||||||||
- type: custom-response | ||||||||||||||
config: | ||||||||||||||
body: Hey, no auth for you ${actions.ngrok.oauth.identity.name}! | ||||||||||||||
body: Hey, no auth for you ${actions.ngrok.oauth.identity.name}! | ||||||||||||||
status_code: 400 | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
|
@@ -215,9 +215,9 @@ This rule uses the `actions.ngrok.oidc.identity_token` [OIDC action result varia | |||||||||||||
on_http_request: | ||||||||||||||
- name: OIDC | ||||||||||||||
actions: | ||||||||||||||
- type: openid-connect | ||||||||||||||
config: | ||||||||||||||
issuer_url: https://accounts.google.com | ||||||||||||||
- type: openid-connect | ||||||||||||||
config: | ||||||||||||||
issuer_url: https://accounts.google.com | ||||||||||||||
Comment on lines
+218
to
+220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
client_id: <your-oidc-client-id> | ||||||||||||||
client_secret: <your-oidc-client-secret> | ||||||||||||||
scopes: | ||||||||||||||
|
@@ -226,9 +226,9 @@ on_http_request: | |||||||||||||
- name: Headers | ||||||||||||||
actions: | ||||||||||||||
- type: add-headers | ||||||||||||||
- type: add-headers | ||||||||||||||
config: | ||||||||||||||
headers: | ||||||||||||||
headers: | ||||||||||||||
id-token: ${actions.ngrok.oidc.identity_token} | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
|
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 should be indented out further so that it matches with the dashes around
BEGIN CERTIFICATE
. Hard to say in GitHub's editor here, but I think this is right?