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
44
Bindanのススメ
"バックエンドを切り替えつつ設定を集約して書きたい" というタイトルのLTの資料です。
Kanazawa.rb meetup #156 at ビブリオバウム での発表です。
wtnabe
August 16, 2025
Tweet
Share
More Decks by wtnabe
See All by wtnabe
Rubyでもモノリポしたい - 調査、おわわり編 -
wtnabe
0
33
Ruby de Railway Oriented Programming
wtnabe
0
67
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
61
Effective Jekyll
wtnabe
0
89
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
52
Ruby de Wasm
wtnabe
0
81
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
63
Decoupled System with Turbo Frame
wtnabe
1
160
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
830
Other Decks in Programming
See All in Programming
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
400
文字コードの話
qnighy
43
16k
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
120
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
2.2k
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
110
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
1
340
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
100
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
290
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
360
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
120
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
Featured
See All Featured
Docker and Python
trallard
47
3.7k
Test your architecture with Archunit
thirion
1
2.2k
We Are The Robots
honzajavorek
0
190
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Ethics towards AI in product and experience design
skipperchong
2
210
Everyday Curiosity
cassininazir
0
150
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
230
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
64
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.7k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
72k
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 さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え