Can I use std::env::args in lazy-static?

Has anyone tried to use std::env::args in lazy_static!?
Because when using the database, ipAddr will change due to the environment.
So I want to use the environment variable, or specify it from the command line.

Excuse me, can I dynamically specify contact points?

lazy_static! {
    static ref SESSION: Session = {
        Cluster::default()
            //Dynamically specify contact points,can i ?
            .set_contact_points(ipAddr) 
                .expect("Failed to set_contact_points")
            .set_port(9042)
                .expect("Failed to set_port")
            .set_num_threads_io(8)
                .expect("Failed to set_num_threads_io")
            .connect()
                .expect("Failed to connect to the cluster")
    };
}

Why don’t you just try it? Go to https://playground.rust-lang.org and just try it. It’s much better than asking if anyone has ever tried it (expect that you can write afterwards if it works :slight_smile: )