AzureAppConfig
An unofficial Ruby library for Azure App Configuration.
Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add azure_app_config
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install azure_app_config
Usage
Setup
You'll need to first set up some environment variables in order to use the gem.
AZURE_APP_CONFIG_STORE_NAME = "somestore" // The name of the store to use. This would be used to build the url to the store (https://somestore.azconfig.io)
AZURE_APP_CONFIG_CREDENTIAL = "Id" // The credential (ID) to use. (Find this in App Configuration > Settings > Access Keys).
AZURE_APP_CONFIG_SECRET = "some_secret" // The secret to use. (Find this in App Configuration > Settings > Access Keys).
AZURE_APP_CONFIG_API_VERSION = "1.0" // The API version to use. Defaults to 1.0.
AZURE_APP_CONFIG_KEY_PREFIX = ".appconfig.featureflag/" // The key prefix to use. Defaults to ".appconfig.featureflag/"
Examples
require "azure_app_config"
AzureAppConfig::Base.keys
AzureAppConfig::Base.keys(name: ["key1", "key2"])
AzureAppConfig::Base.keys(name: "key1*")
AzureAppConfig::Base.fetch("key1")
AzureAppConfig::Base.fetch("key1", label: 'prod')
AzureAppConfig::Base.fetch("non_existent", label: 'prod')
AzureAppConfig::Base.all
AzureAppConfig::Base.all(name: "key1*")
AzureAppConfig::Base.all(name: "key1*", label: "prod")
AzureAppConfig::Base.all(name: ["key1", "key2"], label: "prod")
AzureAppConfig::Base.labels
AzureAppConfig::Base.labels(name: "p*")
AzureAppConfig::Base.labels(name: ["prod", "test"])
AzureAppConfig::Base.enabled?("key1")
AzureAppConfig::Base.enabled?("key2", label: 'prod')
AzureAppConfig::Base.disabled?("key1")
AzureAppConfig::Base.disabled?("key2", label: 'prod')
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/shettytejas/azure_app_config. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the AzureAppConfig project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.