-
-
Notifications
You must be signed in to change notification settings - Fork 13
Split out policy file (de)serialization to a subcrate #935
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4e50009
Enable default `clap` features in `crates/cli`
bal-e 1a53651
[policy/file] Remove defaults from `KeyManagerSpec::parse()`
bal-e 779e7b9
Create subcrate `cascade-policy-file`
bal-e 5493f51
Copy `src/policy/file/v1.rs` to subcrate
bal-e 92ae3fe
Use `cascade-policy-file` from `cascaded`
bal-e 4f8a724
Expose `cascade_policy_file::datetime`
bal-e File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| [package] | ||
| name = "cascade-policy-file" | ||
| description = "Cascade's policy files." | ||
|
|
||
| authors.workspace = true | ||
| homepage.workspace = true | ||
| documentation.workspace = true | ||
| repository.workspace = true | ||
| license.workspace = true | ||
|
|
||
| version.workspace = true | ||
| rust-version.workspace = true | ||
| edition.workspace = true | ||
|
|
||
| readme = "README.md" | ||
|
|
||
|
|
||
| # --- Dependencies ------------------------------------------------------------- | ||
|
|
||
| [dependencies] | ||
|
|
||
| # The user can specify filesystem paths to Cascade. Paths need to be represented | ||
| # in a platform-independent way, ruling out 'std::path::Path'. 'camino' offers | ||
| # UTF-8-only paths that match this requirement. | ||
| [dependencies.camino] | ||
| workspace = true | ||
| features = ["serde1"] | ||
|
|
||
| [dependencies.domain] | ||
| workspace = true | ||
| features = ["tsig", "serde"] | ||
|
|
||
| # 'foldhash' offers fast, non-cryptographic hash tables. | ||
| [dependencies.foldhash] | ||
| workspace = true | ||
|
|
||
| # 'jiff' is a general-purpose time library. | ||
| [dependencies.jiff] | ||
| workspace = true | ||
|
|
||
| # 'serde' and 'toml' are used for parsing TOML configuration files. | ||
| [dependencies.serde] | ||
| workspace = true | ||
| features = ["derive"] | ||
| [dependencies.toml] | ||
| workspace = true | ||
|
|
||
| # 'serde-with' provides helpers for 'serde'. | ||
| [dependencies.serde_with] | ||
| workspace = true |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| //! Definitions for Cascade policy files. | ||
|
|
||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| //--- Versions | ||
|
|
||
| pub mod v1; | ||
|
|
||
| //--- Helpers | ||
|
|
||
| mod datetime; | ||
|
|
||
| //----------- VersionedSpec ---------------------------------------------------- | ||
|
|
||
| /// A versioned policy file specification. | ||
| #[derive(Clone, Debug, Serialize, Deserialize)] | ||
| #[serde(rename_all = "kebab-case", tag = "version")] | ||
| pub enum VersionedSpec { | ||
| /// The version 1 format. | ||
| V1(v1::Spec), | ||
| } | ||
|
|
||
| // TODO(idea @bal-e): Define a version-independent policy file specification? | ||
| // - Would be called `Spec`. | ||
| // - Initially reuse definitions from `v1`. | ||
| // - `Spec` could be converted to and from `VersionedSpec` explicitly. | ||
| // - Convert from any version, always build the latest version. | ||
| // - Maybe also provide conversions to and from every individual version. | ||
| // - Conversions _to_ individual versions might need to be fallible. | ||
| // - Unclear if conversion to the latest version can/should be fallible. | ||
| // - It would let users write policy files without locking themselves to a | ||
| // particular version. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.