Skip to content

Commit 072db7a

Browse files
authored
Fb/docs polish (#18)
* more scope info * add cloc to example cap server * better cloc
1 parent be056bd commit 072db7a

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

docs/architecture/index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,17 @@ by using
7979

8080
- `changeFeatureValue(key, "new value for t1", { tenant: "t1" })`
8181

82-
And we could change the behavior again with for the more specific tenant `t1` and user `john`, by using
82+
And we could change the behavior again with for the more specific user `john` and tenant `t1`, by using
8383

8484
- `changeFeatureValue(key, "new value just for john within t1", { user: "john", tenant: "t1" })`
8585

8686
{: .warn}
8787
As we can see in the precedence check order, if we had just set `changeFeatureValue(key, "new value for john", { user: "john" })`,
8888
then it depends on the order used in the `getFeatureValue` call, whether the `user` scope is evaluated before
8989
the `tenant` scope.
90+
91+
Note that the scoping concept is not opinionated about which particular information you use to discriminate a feature
92+
toggle's value at runtime. There is a practical limit that only 4 scopes can be used at once, because the precedence
93+
checks grow exponentially in the number of scopes. But other than that, you can use any 4 strings. In other words, the
94+
scopes need not be `tenant` or `user`, they could be code component information, like the `__filename`, or whatever
95+
seems natural for you to use and is easy to predict for the user-group where changes should occur.

example-cap-server/cloc.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CDS
2+
filter rm_comments_in_strings " /* */
3+
filter rm_comments_in_strings " //
4+
filter call_regexp_common C++
5+
extension cds
6+
3rd_gen_scale 1.00

example-cap-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"name": "example-cap-server",
44
"version": "1.0.0",
55
"scripts": {
6-
"start": "cds-serve"
6+
"start": "cds-serve",
7+
"cloc": "npx cloc --vcs=git --read-lang-def=cloc.def ."
78
},
89
"dependencies": {
910
"@cap-js-community/feature-toggle-library": "file:..",

0 commit comments

Comments
 (0)