-
Notifications
You must be signed in to change notification settings - Fork 36
Description
I would like to use Cloud Spanner Emulator to develop this gem and to develop Rails application using gem. Although, there are limitations and differences, the emulator does not cost money 💸 and the separated environments are suited for local development.
https://cloud.google.com/spanner/docs/emulator
Then, I've found out that the current implementation of this library does not support emulator.
This is because Google::Cloud.spanner
is used instead of Google::Cloud::Spanner.new
. The former method pass the limited portion of parameters to the latter.
@spanners[database_path(config)] ||= Google::Cloud.spanner( | |
config[:project], | |
config[:credentials], | |
scope: config[:scope], | |
timeout: config[:timeout], | |
client_config: config[:client_config]&.symbolize_keys, | |
lib_name: "spanner-activerecord-adapter", | |
lib_version: ActiveRecordSpannerAdapter::VERSION | |
) |
If we directly call Google::Cloud::Spanner.new(config)
, we can pass the emulator_host
parameter in config, which enable developers to use Cloud Spanner Emulator.
Although, this breaks config[:project]
, config[:credentials]
compatibility, I think keeping consistency with Google::Cloud::Spanner.new
reduces maintenance cost.
Of course, If required, I can write backward-compatible code.
If the above strategy is O.K., I am willing to work on this issue.