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
27
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
36
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
39
Effective Jekyll
wtnabe
0
68
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
35
Ruby de Wasm
wtnabe
0
62
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
51
Decoupled System with Turbo Frame
wtnabe
1
140
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
800
let-me-edit-with-editor
wtnabe
0
350
Other Decks in Programming
See All in Programming
Blazing Fast UI Development with Compose Hot Reload (droidcon London 2025)
zsmb
0
500
Core MIDI を勉強して作曲用の電子ピアノ作ってみた!
hypebeans
0
100
SidekiqでAIに商品説明を生成させてみた
akinko_0915
0
130
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
120
Kotlin + Power-Assert 言語組み込みならではのAssertion Library採用と運用ベストプラクティス by Kazuki Matsuda/Gen-AX
kazukima
0
110
r2-image-worker
yusukebe
1
160
Making Angular Apps Smarter with Generative AI: Local and Offline-capable
christianliebel
PRO
0
110
高単価案件で働くための心構え
nullnull
0
110
Kotlin 2.2が切り拓く: コンテキストパラメータで書く関数型DSLと新しい依存管理のかたち
knih
0
400
『HOWはWHY WHATで判断せよ』 〜『ドメイン駆動設計をはじめよう』の読了報告と、本質への探求〜
panda728
PRO
1
740
Vueで学ぶデータ構造入門 リンクリストとキューでリアクティビティを捉える / Vue Data Structures: Linked Lists and Queues for Reactivity
konkarin
1
160
AI POSにおけるLLM Observability基盤の導入 ― サイバーエージェントDXインターン成果報告
hekuchan
0
470
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
56
14k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Context Engineering - Making Every Token Count
addyosmani
9
380
jQuery: Nuts, Bolts and Bling
dougneiner
65
8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
GraphQLとの向き合い方2022年版
quramy
49
14k
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 さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え