From cd5ef415b594134ddba06df9b05eb5eb4279cc25 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 29 Sep 2023 00:20:06 +0100 Subject: [PATCH] daily-email: add 2023-09-27 Separating environments with feature flags --- src/content/daily-email/2023-09-27.md | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/content/daily-email/2023-09-27.md diff --git a/src/content/daily-email/2023-09-27.md b/src/content/daily-email/2023-09-27.md new file mode 100644 index 000000000..0315396df --- /dev/null +++ b/src/content/daily-email/2023-09-27.md @@ -0,0 +1,28 @@ +--- +title: > + Separating environments with feature flags +pubDate: 2023-09-27 +permalink: > + archive/2023/09/27/separating-environments-with-feature-flags +tags: + - software-development + - feature-flags +--- + +You have two or more environments and versions of your application, but you do trunk-based development, so you only have a single branch that you use on all environments. + +But if all environments have the same code, how can we have differences between them? + +What if we want a feature enabled on one environment and not the other? + +## Feature flags + +Feature flags are an approach I've previously written about. You have two branches of logic within your code, and the flow changes based on whether a flag is enabled. + +If a flag is enabled, execute the first block of code. Otherwise, execute the second. + +Now, you enable and disable the required feature flags for each environment. + +**The code is the same for all environments, but the enabled features and functionality are different.** + +Then, once the feature has been deployed and released in production, the feature flag can be removed.