-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Feature Flagging
Feature flags is a way to have features under development live on production and visible only to admins/beta-users.
The idea of Feature Flags came from Flicker. They manage their development on a single branch using feature flags. Here is a link
Feature flags are used in templates and in controller classes. To make some part of the template visible only if a feature-flag is enabled:
$if "lists" in ctx.features:
<h3>Lists</h3>
$for list in page.get_lists():
...
To enable a url only if a feature flag is enabled:
class home(delegate.page):
path = "/"
def is_enabled(self):
return "home-v2" in web.ctx.features
def GET(self):
return render_template("home")
In Open Library, the feature flags are specified in the openlibrary.yml file as follows:
features:
merge-authors: enabled
lists: admin
lending_v2:
filter: usergroup
usergroup: beta-users
The value of a feature flag is called a filter. A filter can be specified either as its name or as a dict containing its name and parameters. For example, the following 2 example mean the same.
features:
lists: admin
features:
lists:
filter: admin
Available filters are:
-
enabled Enabled for all users.
-
disabled Disabled for all users.
-
loggedin Enabled only for logged-in users.
-
admin Enabled for admin users.
-
usergroup Enabled for the users part of the specified usergroup.
lending_v2:
filter: usergroup
usergroup: beta-users
- queryparam Enabled only if the url has a specified query parameter.
debug:
filter: queryparam
name: debug
value: true
Getting Started & Contributing
- Setting up your developer environment
- Using
git
in Open Library - Finding good
First Issues
- Code Recipes
- Testing Your Code, Debugging & Performance Profiling
- Loading Production Site Data ↦ Dev Instance
- Submitting good Pull Requests
- Asking Questions on Gitter Chat
- Joining the Community Slack
- Attending Weekly Community Calls @ 9a PT
- Applying to Google Summer of Code & Fellowship Opportunities
Developer Resources
- FAQs: Frequently Asked Questions
- Front-end Guide: JS, CSS, HTML
- Internationalization
- Infogami & Data Model
- Solr Search Engine Manual
- Imports
- BookWorm / Affiliate Server
- Writing Bots
Developer Guides
- Developing the My Books & Reading Log
- Developing the Books page
- Understanding the "Read" Button
- Using cache
- Creating and Logging into New Users
- Feature Flagging
Other Portals
- Design
- Librarianship
- Communications
- Staff (internal)
Legacy
Old Getting Started
Orphaned Editions Planning
Canonical Books Page