-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for external resources (#22)
* add support for reading environment variables * add support for properties and add https: to allowed resources to allow reading packages * add docs + update readme * version bump to 0.3.5 * include example for evaluator options
- Loading branch information
Showing
9 changed files
with
236 additions
and
42 deletions.
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 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 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 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,23 @@ | ||
use std::path::PathBuf; | ||
|
||
use rpkl::api::evaluator::EvaluatorOptions; | ||
use serde::Deserialize; | ||
|
||
#[allow(dead_code)] | ||
#[derive(Debug, Deserialize)] | ||
struct Config { | ||
path: String, | ||
name: String, | ||
} | ||
|
||
fn main() { | ||
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) | ||
.join("tests") | ||
.join("pkl") | ||
.join("allowed-resources.pkl"); | ||
|
||
let options = EvaluatorOptions::default().properties([("name", "Ferris")]); | ||
let config: Config = rpkl::from_config_with_options(path, Some(options)).unwrap(); | ||
|
||
println!("{:?}", config); | ||
} |
This file contains 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 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 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 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 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,4 @@ | ||
path = read("env:PATH") | ||
name = read("prop:name") | ||
|
||
// package = read("package://pkg.pkl-lang.org/pkl-pantry/[email protected]#/toml.pkl") |