Skip to content

Commit

Permalink
docs: updated filepaths for schema store regex (#344)
Browse files Browse the repository at this point in the history
Signed-off-by: James Milligan <james@omnant.co.uk>

<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->

## This PR
<!-- add the description of the PR here -->

- updates file paths to conform to schema store regex

### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->

### Notes
<!-- any additional notes for this PR -->

### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->

### How to test
<!-- if applicable, add testing instructions under this section -->

---------

Signed-off-by: James Milligan <james@omnant.co.uk>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
  • Loading branch information
james-milligan and beeme1mr authored Feb 16, 2023
1 parent feb7f04 commit 2d0e9d9
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build:
test:
go test -race -covermode=atomic -cover ./pkg/... -coverprofile=coverage.out
run:
go run main.go start -f file:config/samples/example_flags.json
go run main.go start -f file:config/samples/example_flags.flagd.json
install:
cp systemd/flagd.service /etc/systemd/system/flagd.service
mkdir -p /etc/flagd
Expand Down
134 changes: 134 additions & 0 deletions config/samples/example_flags.flagd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"flags": {
"myBoolFlag": {
"state": "ENABLED",
"variants": {
"on": true,
"off": false
},
"defaultVariant": "on"
},
"myStringFlag": {
"state": "ENABLED",
"variants": {
"key1": "val1",
"key2": "val2"
},
"defaultVariant": "key1"
},
"myFloatFlag": {
"state": "ENABLED",
"variants": {
"one": 1.23,
"two": 2.34
},
"defaultVariant": "one"
},
"myIntFlag": {
"state": "ENABLED",
"variants": {
"one": 1,
"two": 2
},
"defaultVariant": "one"
},
"myObjectFlag": {
"state": "ENABLED",
"variants": {
"object1": {
"key": "val"
},
"object2": {
"key": true
}
},
"defaultVariant": "object1"
},
"isColorYellow": {
"state": "ENABLED",
"variants": {
"on": true,
"off": false
},
"defaultVariant": "off",
"targeting": {
"if": [
{
"==": [
{
"var": [
"color"
]
},
"yellow"
]
},
"on",
"off"
]
}
},
"fibAlgo": {
"variants": {
"recursive": "recursive",
"memo": "memo",
"loop": "loop",
"binet": "binet"
},
"defaultVariant": "recursive",
"state": "ENABLED",
"targeting": {
"if": [
{
"$ref": "emailWithFaas"
}, "binet", null
]
}
},
"headerColor": {
"variants": {
"red": "#FF0000",
"blue": "#0000FF",
"green": "#00FF00",
"yellow": "#FFFF00"
},
"defaultVariant": "red",
"state": "ENABLED",
"targeting": {
"if": [
{
"$ref": "emailWithFaas"
},
{
"fractionalEvaluation": [
"email",
[
"red",
25
],
[
"blue",
25
],
[
"green",
25
],
[
"yellow",
25
]
]
}, null
]
}
}
},
"$evaluators": {
"emailWithFaas": {
"in": ["@faas.com", {
"var": ["email"]
}]
}
}
}
88 changes: 88 additions & 0 deletions config/samples/example_flags.flagd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
flags:
myBoolFlag:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'on'
myStringFlag:
state: ENABLED
variants:
key1: val1
key2: val2
defaultVariant: key1
myFloatFlag:
state: ENABLED
variants:
one: 1.23
two: 2.34
defaultVariant: one
myIntFlag:
state: ENABLED
variants:
one: 1
two: 2
defaultVariant: one
myObjectFlag:
state: ENABLED
variants:
object1:
key: val
object2:
key: true
defaultVariant: object1
isColorYellow:
state: ENABLED
variants:
'on': true
'off': false
defaultVariant: 'off'
targeting:
if:
- "==":
- var:
- color
- yellow
- 'on'
- 'off'
fibAlgo:
variants:
recursive: recursive
memo: memo
loop: loop
binet: binet
defaultVariant: recursive
state: ENABLED
targeting:
if:
- "$ref": emailWithFaas
- binet
- null
headerColor:
variants:
red: "#FF0000"
blue: "#0000FF"
green: "#00FF00"
yellow: "#FFFF00"
defaultVariant: red
state: ENABLED
targeting:
if:
- "$ref": emailWithFaas
- fractionalEvaluation:
- email
- - red
- 25
- - blue
- 25
- - green
- 25
- - yellow
- 25
- null
"$evaluators":
emailWithFaas:
in:
- "@faas.com"
- var:
- email
36 changes: 36 additions & 0 deletions config/samples/example_flags_secondary.flagd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"flags": {
"myBoolFlag": {
"state": "ENABLED",
"variants": {
"on": true,
"off": false
},
"defaultVariant": "off"
},
"isColorGreen": {
"state": "ENABLED",
"variants": {
"on": true,
"off": false
},
"defaultVariant": "off",
"targeting": {
"if": [
{
"==": [
{
"var": [
"color"
]
},
"yellow"
]
},
"on",
"off"
]
}
}
}
}
8 changes: 4 additions & 4 deletions docs/usage/evaluation_examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
1. Download sample flag configuration:

```shell
curl https://raw.githubusercontent.com/open-feature/flagd/main/config/samples/example_flags.json -o example_flags.json
curl https://raw.githubusercontent.com/open-feature/flagd/main/config/samples/example_flags.flagd.json -o example_flags.flagd.json
```

1. Run one of the following commands, depending on how [flagd was installed](../usage/getting_started.md):
- binary:

```shell
flagd start --uri file:example_flags.json
flagd start --uri file:example_flags.flagd.json
```

- Docker:

```shell
docker run -p 8013:8013 -v $(pwd)/:/etc/flagd/ -it --pull=always ghcr.io/open-feature/flagd:latest start --uri file:./etc/flagd/example_flags.json
docker run -p 8013:8013 -v $(pwd)/:/etc/flagd/ -it --pull=always ghcr.io/open-feature/flagd:latest start --uri file:./etc/flagd/example_flags.flagd.json
```

1. Changes made in `example_flags.json` will immediately take affect. Go ahead, give a shot!
1. Changes made in `example_flags.flagd.json` will immediately take affect. Go ahead, give a shot!

Flagd is now ready to perform flag evaluations over either HTTP or gRPC. In this example, we'll utilize HTTP via cURL.
Expand Down

1 comment on commit 2d0e9d9

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Go Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 2d0e9d9 Previous: 33413f2 Ratio
BenchmarkResolveObjectValue/test_targetingObjectFlag 21504 ns/op 6106 B/op 104 allocs/op 15556 ns/op 6106 B/op 104 allocs/op 1.38

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.