Skip to content
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

implement AND of settings #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

implement AND of settings #14

wants to merge 1 commit into from

Conversation

lpw
Copy link

@lpw lpw commented Aug 14, 2019

After a few requests for this missing conditional expression, and witnessing the unfortunate workarounds from not having it (usually dropping back to code), this is a overloaded implementation of setting which now also takes an array where each item is a setting and the resulting evaluation is true iff each and every setting also evaluates to true. Similar to buckets or environment taking an array.

- setting: andOfFooAndBar
  value: false
  except:
    - value: true
      setting:
        - foo
        - bar

or

- setting: andOfFooAndBar
  value: false
  except:
    - value: true
      setting: [foo, bar]

This overloads setting in a backwards compatible way by checking the type of setting.

@scsper @juandopazo @cyrils @markandey

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@coveralls
Copy link

coveralls commented Aug 14, 2019

Coverage Status

Coverage increased (+0.02%) to 97.325% when pulling 13932b2 on lpw:settings into 8f356b9 on yahoo:master.

@cyrils
Copy link

cyrils commented Aug 14, 2019

👍

@scsper
Copy link
Collaborator

scsper commented Aug 14, 2019

could we either:

change setting to accept a string or an array (backwards compatible) or deprecate setting in favor of settings (major version change)? i don't like having both setting and settings, as that can be confusing to people

@lpw
Copy link
Author

lpw commented Aug 14, 2019

@scsper done

I'd wanted to overload setting but figured there'd be objections to not having tighter typing for validation (didn't want to introduce any major version change, so just overloaded setting).

@markandey
Copy link

@juandopazo can you merge and publish the npm ??

@scsper
Copy link
Collaborator

scsper commented Aug 14, 2019

@lpw could you also update the readme?

@lpw
Copy link
Author

lpw commented Aug 14, 2019

@scsper updated README

theogravity added a commit to theogravity/configurity that referenced this pull request May 28, 2020
- Define configuration using a YAML file (you can still use the original `Cerebro` object if you want to use JSON)
- environment variable overrides
- Incorporates [AND of settings](yahoo#14) by @lpw
- Updated parts of the codebase to Typescript
- Updated parts of the codebase to classes
- Updated toolchain to be typescript-based
- Added new methods to the config object
- Re-written readme / updated usage examples to use the YAML format instead
@theogravity
Copy link
Contributor

theogravity commented May 28, 2020

I've incorporated this PR into an improved version of cerebro:

https://github.com/theogravity/configurity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants