-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[feat] Allow Tauri configurations to be set in Tauri.toml and/or Cargo.toml #4806
Comments
We do have JSON5 support though. And we could easily add toml support. |
I saw in your commit that you're adding |
I would prefer Tauri.toml too but it would mean some new additions that doesn't align well with the current API (that only leverages different file extensions). |
Ahh I just remembered the config module is documented as unstable so I can do some changes :) (otherwise adding any new config value would be impossible since everything is also public for the codegen step). |
@adaptive-simon Your wish is my command :) |
Omg awesome! You're the best!! 😄 |
Now we just need to update the documentation :) |
Describe the problem
As a Rust developer I have a certain love for the TOML format. There's nothing directly wrong with the JSON configuration file, it's just not as easy to manage as a TOML file. For example, you can't add comments in a JSON file, something that would be very useful for the Tauri config seeing as it has gotten pretty long, there's a lot of stuff to keep in memory regarding why you do things in your configs and it would be very nice to be able to put comments in there.
Describe the solution you'd like
Add the ability to write configurations in a
Tauri.toml
file, and/or directly in theCargo.toml
file. Due to best practises with Cargo.toml however it's probably best to use a Tauri.toml file.Implementing this feature shouldn't be much more work than to find the configuration from either Cargo.toml or Tauri.toml, converting TOML into JSON, then passing it forward into existing functionality. As can be seen above with how I put
allowlist
at the root of the Tauri.toml file, it may be preferable to do some restructuring of the configurations if you add them to TOML since a Tauri.toml file containing a[tauri]
section doesn't make much sense, but since that can make it a bit difficult to maintain both the JSON and TOML variants restructuring isn't really necessary.Alternatives considered
Alternatively a less user friendly variant but makes it easier to maintain both the JSON and TOML variants:
This variant might make it a bit easier to maintain both the JSON and TOML variants, since the other suggested solution may involve some slight restructuring of the config file.
Additional context
Here's a little utility function I wrote for Cargo Commander for converting JSON to Toml. Can be used as inspiration.
https://github.com/adaptive-simon/cargo-commander/blob/main/src/utils.rs#L240
The text was updated successfully, but these errors were encountered: