Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I resolve anonymous/staticpassword dynamically? #358

Open
sisso opened this issue Dec 25, 2020 · 0 comments
Open

How can I resolve anonymous/staticpassword dynamically? #358

sisso opened this issue Dec 25, 2020 · 0 comments

Comments

@sisso
Copy link

sisso commented Dec 25, 2020

I was trying to make my credentials configurable. Like this:

    let session = if let Some((user, pass)) = pass {
        let auth = StaticPasswordAuthenticator::new(user, pass);
        let node = NodeTcpConfigBuilder::new("127.0.0.1:9042", auth).build();
        let cluster_config = ClusterTcpConfig(vec![node]);
        session::new(&cluster_config, RoundRobin::new()).expect("session should be created")
    } else {
        let auth = NoneAuthenticator {};
        let node = NodeTcpConfigBuilder::new("127.0.0.1:9042", auth).build();
        let cluster_config = ClusterTcpConfig(vec![node]);
        session::new(&cluster_config, RoundRobin::new()).expect("session should be created")
    };

That obviously fails as it will generate incompatible types. What would be the proper way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant