Comments (5)
Can you elaborate on something you want to do that's cumbersome to do with the current design? Config
is a very small structure with a very simple API, so I can't imagine anything that would be too cumbersome.
from rocket.
As I said, redundant (as in not needed, needlessly complicating api for me). I want to make single exe application that you can drop in anywhere and run it, no configuration needed. When you want configuration, you pass it as arguments from the command line. Having a config file is really not an option for me. I can still make custom Config by calling Config::default_for but that requires filepath, which I don't have or need.
More generally, it would be really good if you would not force configuration file and specific configuration format on everyone, as that seems to be in contradiction with https://rocket.rs/guide/introduction/#foreword point 3.
from rocket.
I think this is a blunder with the API, and one that I was aware of but didn't change prior to releasing. You don't need to have a file for the configuration, you just need to give the default_for
method a path, even if the file it refers to doesn't exist. Rocket itself does this by using the CWD plus a default config name. The path is required because Rocket needs to determine where paths in the config file are relative to, and it uses the configuration file path passed to this function to determine it. This is really strange, and the API needs to be changed to allow a file-path-less config.
With this change, would you still feel Rocket is forcing a decision on you? The configuration structure is small, and any trait to make the configuration structure generic will require more work to implement than building a Config
structure from defaults.
from rocket.
Yes, file-path-less config sounds good enough. I would still suggest trait based api because I think it would be much easier to maintain/extend in the future.
I like the concept of configuration environment defaults (dev/staging/production), but to some even they may seem redundant.
I would suggest adding new
function without any arguments (it can initialize Config
like Environment::Production
would) and a second 'constructor' (maybe default_with
) which would take Environment
as an argument.
from rocket.
Resolved in fb24ee3.
from rocket.
Related Issues (20)
- Getting several lints on a #[derive(FromForm)] HOT 1
- Receiving ">>> Request guard `…` is forwarding" messages with log_level=critical HOT 6
- debug!("Received request: {:#?}", hyp_req); HOT 4
- Can't make private cookie not secure HOT 4
- Rocket does not return a 413 when the data submitted in a form exceeds the limit HOT 7
- Build fails with rustc<=1.68.2 HOT 3
- Update `hyper` to `1.0` HOT 1
- Conflicts among routes when `FileServer::rank()` function is used HOT 11
- Getting several no_effect_underscore_binding lints on #[launch] HOT 1
- Hello world example compiler error: macro-expanded `macro_export` HOT 2
- Handling of null bytes in forms is problematic HOT 6
- Improvements for the web serach: Content-Type, text/plain HOT 4
- Phase out async_trait macro HOT 2
- Recognise source maps in `ContentType::from_extension` HOT 2
- route rank clarification HOT 1
- Link to GitHub discussion from the web site HOT 1
- Supply PanicInfo to Catchers where applicable HOT 2
- (Solved) Rocket database fairing panicking while connecting to dockerized postgres on MacOS Sonoma HOT 1
- how to return error as a Json from FromParam HOT 3
- Responder enums not serializing like expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rocket.