Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upBetter ergonomics for calling infer_schema when the database URL is not in the environment #689
Comments
This comment has been minimized.
|
There's not really any way to make this easier or more ergonomic. In order to make We have special handling for environment variables because it's a common pattern that is easy for us to support without forcing additional opinions on the application. For us to support some sort of configuration file today, we'd have to enforce a specific opinion about how configuration files should work for your application, which is not something I want to do in an ORM. As an aside, is there a specific reason that using |
sgrif
closed this
Feb 12, 2017
This comment has been minimized.
mehcode
commented
Aug 11, 2017
|
Sorry it took me so long to come back to this.
In my projects I have (something like):
Configuration flows in from When I add a
I can understand that. At least it's on the radar and that
Now here is where I'd like to make an actionable suggestion. Would it be acceptable to expose a programmatic interface for running the CLI? It doesn't seem that coupled to the I'm thinking something along the lines of: diesel_cli::run();
diesel_cli::run_with_args(&matches);^ That would just do essentially what the My vision for this is being able to mount the diesel cli so it's run like Another idea that could work is doing |
mehcode commentedFeb 12, 2017
I'm trying to use https://crates.io/crates/config (to centralize configuration) with Diesel. Diesel really wants me to use environment variables for everything.
In order to get a value out of
configto use ininfer_schema!I currently have something like the below in mybuild.rs. Any ideas to make this more ergonomic (or am I missing an easier way to do this)?