Conversation
|
Well, if we're agree that features should be discoverable, may be not introduce intermediate short live solutions that will break backward compatibility at some point? |
|
Don't get me wrong about your effort for pushing this feature forward. I worry about all future oblivious improvements for this feature which aren't fit into current implementation. So it'll have to be changed and since it's a thing that users may use in own fashion, such changes may not be harmless. |
They are discoverable. config:features() returns all feature flags.
Then we'll change the implementation. Where you thinking of a whole new application or other such thing? |
|
@nickva So config true/false switches is how user may control features availability. I'm hard to image a case when I would shutdown some feature, but it looks useful. So I take my words back, sorry for that.
I think new app is a good idea to group there all the features-related logic which will grow in time. For instance, |
| lists:usort([list_to_binary(Key) || {Key, "true"} <- ?MODULE:get(?FEATURES)]). | ||
|
|
||
|
|
||
| feature_enable(Feature) when is_atom(Feature) -> |
There was a problem hiding this comment.
enable_feature and disable_feature reads better, what do you think? Also, can we insist on atom rather than handle atom and binary and list?
There was a problem hiding this comment.
or maybe add_feature / remove_feature. I think you're only supporting remove_feature for testing?
There was a problem hiding this comment.
Yeah enable_feature/disable_feature sounds better. Can make it an atom as well.
vs add/remove, enable/disable has more of an idempotent feel to it. But ok with either way.
Implement ability to enable, disable and query feature flags. Features are identified as atoms. Usage intent is for various components in the system to enable features, then the HTTP API will expose those to the user. For example, features could indicate the presence of an optional component, a plugin or a new mode of operation. The API has 3 functions: * `config:features/0` : Return a sorted list of feature flags * `config:enable_feature/1` : Enables a feature. Feature argument could be a list, a binary or an atom. * `config:disable_feature/1` : Disables a feature. Implementation is a thin wrapper around setting and deleting keys from the '[features]' config section. This means, users can also set their own features there via the .ini config files. Features set via the API are not persistent, so applications will have to set them every time they initialize. COUCHDB-3180
|
+1 |
Implement ability to enable, disable and query feature flags.
Features are identified as binary strings. Usage intent is for
various components in the system to enable features, then the HTTP API will
expose those to the user. For example, features could indicate the presence
of an optional component, a plugin or a new mode of operation.
The API has 3 functions:
config:features/0: Return a sorted list of feature flagsconfig:feature_enable/1: Enables a feature. Feature argument could be alist, a binary or an atom.
config:feature_disable/1: Same asfeature_enable/1but disables thefeature.
feature_enable/1andfeature_disable/1are idempotent.Implementation is a thin wrapper around setting and deleting keys from the
'[features]' config section. This means, users can also set their own features
there via the .ini config files. Features set via the API are not persistent,
so applications will have to set them every time they initialize.
Jira: COUCHDB-3180