Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Adding dynamic values for switches #25

Open
dcramer opened this issue Sep 2, 2011 · 3 comments
Open

Adding dynamic values for switches #25

dcramer opened this issue Sep 2, 2011 · 3 comments

Comments

@dcramer
Copy link
Collaborator

dcramer commented Sep 2, 2011

Gargoyle should be able to handle values other than True/False for switches. This allows you to avoid duplication of "settings" when you want to say "this is either on, or off, and when its on the value should be FOO".

An example API may look like:

sqt = int(gargoyle.get_value('log_slow_query_threshold'))
if sqt:
    logging.info('slow query over threshold of %d!', sqt)

The default values for get_value would be True if enabled, False if not.

In the UI upon add/edit switch you'd be able to customize these values. Considerations are if they should only be strings. Otherwise we could allow JSON values but that means you'd be required to quote strings.

We'd also add the ability to set per-condition specific values. So if condition matches foo, the return value is 100 instead of 10.

@anandology
Copy link

Are you suggesting to make gargoyle.get_value('..') return a value instead of True/False?

@dcramer
Copy link
Collaborator Author

dcramer commented Sep 3, 2011

@anandology only if you configure a non-default return value. In this way Gargoyle could serve as a switches platform with varying responses depending on conditions. It would also make it more suitable for doing things like a/b testing (e.g. maybe under condition a, you want template.html, condition b, template2.html, and condition c template3.html).

@anandology
Copy link

Got it.

At openlibrary, we have pluggable conditions that can take parameters, but the return value is always boolean.

freakboy3742 pushed a commit to zapier/zapier-gargoyle that referenced this issue Sep 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants