# Anyway Config

> A configuration library for Ruby gems and applications.

- URL: https://evilmartians.com/opensource/anyway-config
- GitHub: https://github.com/palkan/anyway_config
- Authors: Vladimir Dementyev

---

Anyway Config is a configuration library for Ruby gems and applications. Avoid “ENV hell” and keep your configuration variables organized, support per-environment and local settings, and properly deal with credentials/secrets.

As a Ruby library author, you can benefit from using Anyway Config by providing a better UX for your end-users:

- **Zero-code configuration**: no more boilerplate initializers.
- **Per-environment and local** settings support out-of-the-box.

For application developers, Anyway Config could be useful to:

- **Keep configuration organized** and use _named configs_ instead of bloated `.env`/`settings.yml`/whatever.
- **Free code of ENV/credentials/secrets dependency** and use configuration classes instead—your code should not rely on configuration data sources.

## Main concepts

Anyway Config abstractizes the configuration layer by introducing **configuration classes** which describe available parameters and their defaults. For example:

```ruby
module Influxer
  class Config < Anyway::Config
    attr_config(
      host: "localhost",
      username: "root",
      password: "root"
    )
  end
end
```

Using Ruby classes to represent configuration allows you to add helper methods and computed parameters easily, and makes the configuration **testable**.

The `anyway_config` gem takes care of loading parameters from **different sources** (YAML, credentials/secrets, environment variables, etc.). Internally, we use a _pipeline pattern_ and provide the Loaders API to manage and extend its functionality.
