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 = {
            //Dynamically specify contact points,can i ?
                .expect("Failed to set_contact_points")
                .expect("Failed to set_port")
                .expect("Failed to set_num_threads_io")
                .expect("Failed to connect to the cluster")

Why don’t you just try it? Go to 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: )