From dc7525200fdc50be23d1f83dd8fa1a8ef2149f0f Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Mon, 30 Sep 2024 19:58:03 +0530 Subject: [PATCH] chore: add env var to http docs --- canary-checker/docs/reference/1-http.mdx | 47 +++++++++++++++++++++--- canary-checker/docusaurus.config.js | 5 +++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/canary-checker/docs/reference/1-http.mdx b/canary-checker/docs/reference/1-http.mdx index 5044a0a5..720fca3a 100644 --- a/canary-checker/docs/reference/1-http.mdx +++ b/canary-checker/docs/reference/1-http.mdx @@ -33,7 +33,8 @@ spec: {field: "responseContent", description: "Expected response content", scheme: "string"}, {field: "thresholdMillis", description: "Request timeout", default: 5000, scheme: "int"}, {field: "maxSSLExpiry", description: "Max SSL expiry days", scheme: "int"}, - {field: "insecureSkipVerify", description: "Skip TLS verification", scheme: "bool"} + {field: "insecureSkipVerify", description: "Skip TLS verification", scheme: "bool"}, + {field: "env", description: "Setup environment variables that are accessible while templating", scheme: "[]EnvVar"}, ]}/> ### TLS Config @@ -68,6 +69,14 @@ spec: +### OAuth + + + ### Result Variables Result variables can be used in `test`, `display` and `transform` [expressions](../concepts/expressions) @@ -107,9 +116,7 @@ spec: -### OAuth - -### Template Body Variables +## Template Body Variables | Name | Scheme | | ----------------------------- | ------------------- | @@ -129,6 +136,37 @@ Eg: In the following spec, the vars `my_secret_path` and `my_secret_var`, define +
+
+```yaml title="http_user_pass_template.yaml" +apiVersion: canaries.flanksource.com/v1 +kind: Canary +metadata: + name: http-basic-auth-url + namespace: canaries +spec: + http: + - name: test-url-via-env + # The URL can be templated from arbritrary values using the env field and $(.) syntax + url: $(.url) + env: + - name: url + value: https://hello:world2@httpbin.demo.aws.flanksource.com/basic-auth/hello/world2 + - name: test-basic-via-env + # the url can be constructed from multiple variables + url: https://$(.user):$(.pass)@httpbin.demo.aws.flanksource.com/basic-auth/hello/world + templateBody: true + body: | + {{. | toJSONPretty " " }} + responseCodes: [200] + env: + - name: user + value: hello + - name: pass + value: world +``` +
+ See Escaping variables ## Metrics @@ -154,4 +192,3 @@ Status class is one of `1xx`, `2xx`, `3xx`, `4xx`, `5xx` ```yaml title="metrics.yaml" file=../../../modules/canary-checker/fixtures/minimal/metrics-transformed.yaml ``` -
diff --git a/canary-checker/docusaurus.config.js b/canary-checker/docusaurus.config.js index ae341779..7dc5ceb9 100644 --- a/canary-checker/docusaurus.config.js +++ b/canary-checker/docusaurus.config.js @@ -117,6 +117,11 @@ export default async function createConfigAsync() { label: 'GitHub', position: 'right', }, + { + href: 'https://cloud-native.slack.com/messages/canary-checker/', + label: 'Slack', + position: 'right', + }, ], }, colorMode: {