The project is in a healthy, maintained state
Pluggable settings stores that fetch secrets from password managers like 1Password and Bitwarden for use with Hanami::Settings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

Hanami::Settings::Stores

Password manager-backed settings stores for Hanami.

Pluggable stores that fetch secrets from password managers like 1Password and Bitwarden, for use with Hanami::Settings.

Requirements

Installation

Using Gem.coop

Add to your Gemfile:

gem "hanami-settings-stores", source: "https://beta.gem.coop/@aaron"

Using Rubygems

Add to your Gemfile:

gem "hanami-settings-stores", source: "https://rubygems.org"

Usage

OnePasswordStore

# config/app.rb

require "hanami/settings/stores"

module MyApp
  class App < Hanami::App
    config.settings_store = Hanami::Settings::CompositeStore.new(
      Hanami::Settings::EnvStore.new,
      Hanami::Settings::OnePasswordStore.new(vault: "Production")
    )
  end
end

Fetch settings from 1Password items. Define mappings with op_setting in your settings class:

# config/settings.rb

module MyApp
  class Settings < Hanami::Settings
    # Looks up field "database_url" on item "MyApp"
    op_setting :database_url, item: "MyApp", constructor: Types::String

    # Looks up field "secret_key" on a different item
    op_setting :api_key, item: "ExternalService", key: :secret_key, constructor: Types::String

    # Regular settings still work — these come from ENV via the default store
    setting :some_flag, default: false, constructor: Types::Params::Bool
  end
end

BitwardenStore

# config/app.rb

require "hanami/settings/stores"

module MyApp
  class App < Hanami::App
    config.settings_store = Hanami::Settings::CompositeStore.new(
      Hanami::Settings::EnvStore.new,
      Hanami::Settings::BitwardenStore.new
    )
  end
end

Fetch settings from Bitwarden items. Define mappings with bw_setting in your settings class:

# config/settings.rb

module MyApp
  class Settings < Hanami::Settings
    bw_setting :database_url, item: "MyApp", constructor: Types::String
    bw_setting :api_key, item: "ExternalService", key: :secret_key, constructor: Types::String

    setting :some_flag, default: false, constructor: Types::Params::Bool
  end
end

CompositeStore

Chain multiple stores with fallback resolution. The first store to return a value wins. Settings resolve from ENV first, falling back to a password manager store for anything not found.

Stores

Store Status
CompositeStore Available
OnePasswordStore Available
BitwardenStore Available

Development

bundle install
mise run spec
mise run ruby

License

MIT