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
60
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Bindanのススメ
"バックエンドを切り替えつつ設定を集約して書きたい" というタイトルのLTの資料です。
Kanazawa.rb meetup #156 at ビブリオバウム での発表です。
wtnabe
August 16, 2025
More Decks by wtnabe
See All by wtnabe
Rubyでもモノリポしたい - 調査、おわわり編 -
wtnabe
0
52
Ruby de Railway Oriented Programming
wtnabe
0
99
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
74
Effective Jekyll
wtnabe
0
97
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
60
Ruby de Wasm
wtnabe
0
90
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
76
Decoupled System with Turbo Frame
wtnabe
1
170
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
850
Other Decks in Programming
See All in Programming
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
400
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.5k
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
200
Lessons from Spec-Driven Development
simas
PRO
0
190
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
7
4.4k
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
350
Oxcを導入して開発体験が向上した話
yug1224
4
310
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
130
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
4.1k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
200
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
150
The Limits of Empathy - UXLibs8
cassininazir
1
360
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
360
How to train your dragon (web standard)
notwaldorf
97
6.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
940
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
54k
The browser strikes back
jonoalderson
0
1.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
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 さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え