From 5012e1dda11bf4825fc10963dd71ef8d313022e7 Mon Sep 17 00:00:00 2001 From: Adam Gardner Date: Sun, 5 Mar 2023 11:10:32 +1000 Subject: [PATCH 1/4] Add targetedFlag Adding a new flag because in https://github.com/open-feature/killercoda/pull/5 I'm trying to explain targeting. This example is explicit in that: - Everyone gets `first` except - Those with `email` containing `@openfeature.dev` - get `second` - Those with `userAgent` containing `Chrome` - get `third`. Signed-off-by: Adam Gardner --- config/samples/example_flags.flagd.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/config/samples/example_flags.flagd.json b/config/samples/example_flags.flagd.json index 0314b5eda..49c3c4d39 100644 --- a/config/samples/example_flags.flagd.json +++ b/config/samples/example_flags.flagd.json @@ -122,6 +122,30 @@ }, null ] } + }, + "targetedFlag": { + "returnType": "string", + "variants": { + "first": "AAA", + "second": "BBB", + "third": "CCC" + }, + "defaultVariant": "first", + "state": "ENABLED", + "targeting": { + "if": [{ + "in": ["@openfeature.dev", { + "var": "email" + }] + }, "second", + { + "in": ["Chrome", { + "var": "userAgent" + }] + }, "third", + null + ] + } } }, "$evaluators": { From fb8ea57125c4c085471bcfcdf9579be6098e7c5b Mon Sep 17 00:00:00 2001 From: Adam Gardner Date: Tue, 7 Mar 2023 07:57:05 +1000 Subject: [PATCH 2/4] Remove unused returnType Signed-off-by: Adam Gardner --- config/samples/example_flags.flagd.json | 1 - 1 file changed, 1 deletion(-) diff --git a/config/samples/example_flags.flagd.json b/config/samples/example_flags.flagd.json index 49c3c4d39..72974289c 100644 --- a/config/samples/example_flags.flagd.json +++ b/config/samples/example_flags.flagd.json @@ -124,7 +124,6 @@ } }, "targetedFlag": { - "returnType": "string", "variants": { "first": "AAA", "second": "BBB", From 84171f07dacf8156594b45e029e9a32a7e9d7653 Mon Sep 17 00:00:00 2001 From: Adam Gardner Date: Tue, 7 Mar 2023 08:02:15 +1000 Subject: [PATCH 3/4] Add targetedFlag to YAML Signed-off-by: Adam Gardner --- config/samples/example_flags.flagd.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/config/samples/example_flags.flagd.yaml b/config/samples/example_flags.flagd.yaml index dac0f4586..0ae2ada77 100644 --- a/config/samples/example_flags.flagd.yaml +++ b/config/samples/example_flags.flagd.yaml @@ -80,9 +80,29 @@ flags: - - yellow - 25 - null + targetedFlag: + variants: + first: "AAA" + second: "BBB" + third: "CCC" + defaultVariant: first + state: ENABLED + targeting: + if: + - "in": + - var: + - "email" + - "@openfeature.dev" + - 'second' + - null + - var: + - "userAgent" + - "Chrome" + - 'third' + - null "$evaluators": emailWithFaas: in: - "@faas.com" - var: - - email \ No newline at end of file + - email From 5e1a539f2fb184db98bde47726982159adc31878 Mon Sep 17 00:00:00 2001 From: Adam Gardner Date: Wed, 8 Mar 2023 07:48:59 +1000 Subject: [PATCH 4/4] Update config/samples/example_flags.flagd.yaml Co-authored-by: Michael Beemer Signed-off-by: Adam Gardner --- config/samples/example_flags.flagd.yaml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/config/samples/example_flags.flagd.yaml b/config/samples/example_flags.flagd.yaml index 0ae2ada77..13fea0d1f 100644 --- a/config/samples/example_flags.flagd.yaml +++ b/config/samples/example_flags.flagd.yaml @@ -88,18 +88,16 @@ flags: defaultVariant: first state: ENABLED targeting: - if: - - "in": - - var: - - "email" - - "@openfeature.dev" - - 'second' - - null - - var: - - "userAgent" - - "Chrome" - - 'third' - - null +if: +- in: + - "@openfeature.dev" + - var: email +- second +- in: + - Chrome + - var: userAgent +- third +- "$evaluators": emailWithFaas: in: