whatyouhide/xandra

:default_consistency is ignored from config

Closed this issue · 7 comments

Reproduction:

set default_consistency: :three in your config file, and the consistency will still be :one.
image

I'm almost 100% sure my settings are right, otherwise I'd not be able to connect to my service and that's not the case.

Hey, thanks for the issue. Can you show the code with which you're starting Xandra? The code

config :app_default, :xandra, ...

doesn't do anything unless you're reading that config, so I'm wondering if that might be the issue?

Hey, thanks for the issue. Can you show the code with which you're starting Xandra? The code

config :app_default, :xandra, ...

doesn't do anything unless you're reading that config, so I'm wondering if that might be the issue?

it had some hardcoded credentials, that's why. but my config is literally this:

config :app_default, :xandra,
    default_consistency: :three,
    name: :default_conn,
    nodes: ["some_amazing_host.domain:port"],
    encryption: true,
    protocol_version: :v4,
    authentication: { Xandra.Authenticator.Password,  [username: "user", password: "pass"] },
    after_connect: &Xandra.execute!(&1, "USE metadata_env;")

anyways, I solved it temporally calling execute/4 while setting up default_consistency explicitly, and it works, but is definitely ignored from the default configs.

@sashapetrovska sorry, I didn't mean to paste the whole config. What I mean is, where are you reading that config? Where are you calling Application.get_env/3 or Application.fetch_env/2?

@sashapetrovska sorry, I didn't mean to paste the whole config. What I mean is, where are you reading that config? Where are you calling Application.get_env/3 or Application.fetch_env/2?

mmh, yeah, but that's not the problem at all, if you're really interested, I got everything running in phoenix, and the Xandra service is being started on the supervisor three on:

image

that's where the config should be loaded from. but as I told you, if the config wasn't loaded correctly then I'd not be able to connect or fetch anything with execute/4.

Ah, got it. Probably a bug indeed then! If you by any chance get the time to try a fix, that would be awesome! Otherwise, I'll have some free cycles to look at this soon 🙃

@sashapetrovska good catch, it was a bug indeed 🐛 Fixed in #268.