This is a Gin web application using a feature flag in Azure App Configuration to dynamically control the availability of a new web page without restarting or redeploying it.
- An Azure account with an active subscription
- An Azure App Configuration store
- A feature flag named "Beta" in your App Configuration store
- Go 1.23 or later
-
Create a feature flag in Azure App Configuration:
Add a feature flag called Beta to the App Configuration store and leave Label and Description with their default values. For more information about how to add feature flags to a store using the Azure portal or the CLI, go to Create a feature flag.
-
Set environment variable:
Windows PowerShell:
$env:AZURE_APPCONFIG_CONNECTION_STRING = "your-connection-string"
Windows Command Prompt:
setx AZURE_APPCONFIG_CONNECTION_STRING "your-connection-string"
Linux/macOS:
export AZURE_APPCONFIG_CONNECTION_STRING="your-connection-string"
go run main.goOpen http://localhost:8080 in your browser.
- Start the application - Beta menu item should be hidden (feature disabled)
- Go to Azure portal → App Configuration → Feature manager
- Enable the "Beta" feature flag
- Wait up to 30 seconds and refresh the page
- Observe the Beta menu item appears in navigation
- Click the Beta menu to access the Beta page
- Disable the flag again and test that
/betareturns 404