Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Bindanのススメ
Search
wtnabe
August 16, 2025
Programming
0
21
Bindanのススメ
"バックエンドを切り替えつつ設定を集約して書きたい" というタイトルのLTの資料です。
Kanazawa.rb meetup #156 at ビブリオバウム での発表です。
wtnabe
August 16, 2025
Tweet
Share
More Decks by wtnabe
See All by wtnabe
Ruby de Railway Oriented Programming
wtnabe
0
20
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
33
Effective Jekyll
wtnabe
0
61
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
29
Ruby de Wasm
wtnabe
0
54
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
46
Decoupled System with Turbo Frame
wtnabe
1
130
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
790
let-me-edit-with-editor
wtnabe
0
340
Other Decks in Programming
See All in Programming
複雑なドメインに挑む.pdf
yukisakai1225
4
880
Vue・React マルチプロダクト開発を支える Vite
andpad
0
110
MLH State of the League: 2026 Season
theycallmeswift
0
210
RDoc meets YARD
okuramasafumi
4
160
Improving my own Ruby thereafter
sisshiki1969
1
140
Protocol Buffersの型を超えて拡張性を得る / Beyond Protocol Buffers Types Achieving Extensibility
linyows
0
100
速いWebフレームワークを作る
yusukebe
3
1.4k
STUNMESH-go: Wireguard NAT穿隧工具的源起與介紹
tjjh89017
0
390
tool ディレクティブを導入してみた感想
sgash708
1
160
パスタの技術
yusukebe
1
550
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
220
ソフトウェアテスト徹底指南書の紹介
goyoki
1
130
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
GitHub's CSS Performance
jonrohan
1032
460k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Art, The Web, and Tiny UX
lynnandtonic
302
21k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Making the Leap to Tech Lead
cromwellryan
134
9.5k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
Facilitating Awesome Meetings
lara
55
6.5k
Transcript
バックエンドを切り替えつつ 設定を集約して書きたい - Bindan のススメ - @wtnabe Kanazawa.rb meetup #156
at ビブリオバウム 2025-08-16 (Sat)
クラウド環境の設定って環境変数に 置くんじゃないんですか?
ENV["FOO"]
実は環境によって都合が悪い
eg) Google App Engine 環境変数の設定方法が設定ファイルのハードコーディング それがイヤならCloud Build で設定ファイルを組み立てる? Cloud Build
の中で扱っている値はログにダダ漏れ
Google 「環境変数に秘密情報置くな」
分かるけど
じゃあsecret から取ってくる? require "google/cloud/secret_manager" secret = Google::Cloud::SecretManaer.new ...
なんかめんどくさい
やっぱこんな感じで書きたい App.configure do |config| config.database.dsn = "sqlite:memory" config.adapter = :grpc
config.pool = 5 config.uploader.bucket = 'production' end この右辺でシュッとsecret 取り出したい
作ったよ https://github.com/wtnabe/bindan
目指した書き味 Bindan.configure(providers: providers) do |c, pr| c.database_host = pr.env["DATABASE_HOST"] ||
"localhost" c.api_key = pr.storage["api_key"] c.feature_flags = pr.firestore["feature_flags_document"] end
もう少し詳しく configure から container と provider が渡ってくる provider が []
メソッドを提供してくれるのでそこで値を取得する pr.env が envvar provider の正体
provider は自分で追加できる Bindan.configure(providers: { env: Bindan::Provider::Envvar.new }) do |container, providers|
今のところ標準で Cloud Storage Cloud Firestore のprovider を提供
NotImplemented SecretManager 対応 configure を複数回に分けて書く
おまけ - 命名について - 名前は最近よくやってる生成AI との議論で 今回はゲルマン祖語で bind みたいな意味 ラテン語だと
vinculum さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え