cassandra_ecto icon indicating copy to clipboard operation
cassandra_ecto copied to clipboard

Read nodes config value from binary

Open rubysolo opened this issue 6 years ago • 4 comments

Hi, thanks for this library!

I would like to be able to specify my Cassandra nodes via an ENV variable so that I can reconfigure at runtime (via RELX_REPLACE_OS_VARS). Would you be open to a PR that would allow nodes to be specified with the current list of tuples syntax or like:

config :my_app, MyApp.Repo,
  nodes: "${CASSANDRA_NODES}",
  keyspace: "my_app"

Then I could start up with e.g. CASSANDRA_NODES=10.0.0.1:9042,10.0.0.2:9042 in my environment.

rubysolo avatar Sep 20 '17 19:09 rubysolo

Hi rubysolo ! did you find a workaround for this?

lucianleustean avatar Feb 05 '18 14:02 lucianleustean

No, I ended up switching the project to a different storage backend. 🙁 However, I am looking at using this library for another project and will need this functionality, so I'll send a PR anyway.

rubysolo avatar Feb 05 '18 14:02 rubysolo

@lucianleustean Are you able to run specs locally? I have to version bump cqerl and espec to get the code to compile (running Elixir 1.6.0 / Erlang 20). Once I do that, I get 21 failures -- 2 in migration_spec.exs and the rest in adapter_spec.exs. At first glance, the failures look like leaking fixture data between spec runs -- the posts table grows by 152 records each run. Perhaps I have not configured Cassandra correctly for the tests?

rubysolo avatar Feb 05 '18 18:02 rubysolo

Hi @rubysolo! sorry I missed your messages. yes I am able to run the test suite locally using MIX_ENV=test mix espec but 2 tests are failing

A PR would be nice to fix node configuration. Atm I am using it hardcode in prod.exs file for production and I don't like it ..

config :app, App.Repo,
  nodes: [{"10.10.10.1", 9042}, {"10.10.10.2", 9042}, {"10.10.10.3", 9042}],
  keyspace: "app_prod",
  replication: {"NetworkTopologyStrategy", dc1: 3}

lucianleustean avatar Mar 15 '18 17:03 lucianleustean