diff --git a/CHANGELOG.md b/CHANGELOG.md index 133ba9d5..d86f6dbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- Add support for `default` key in `launch.toml` in `Process` struct - Support the new `buildpack.toml` fields `description`, `keywords` and `licenses` - Set a minumim required Rust version of 1.56 and switch to the 2021 Rust edition - Stack id in `buildpack.toml` can now be `*` indicating "any" stack diff --git a/src/data/launch.rs b/src/data/launch.rs index adb92aeb..3af69a98 100644 --- a/src/data/launch.rs +++ b/src/data/launch.rs @@ -1,4 +1,5 @@ use crate::data::bom; +use crate::data::defaults; use lazy_static::lazy_static; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -24,7 +25,7 @@ pub struct Launch { /// use libcnb::data::launch; /// let mut launch_toml = launch::Launch::new(); /// let web = launch::Process::new("web", "bundle", vec!["exec", "ruby", "app.rb"], -/// false).unwrap(); +/// false, false).unwrap(); /// /// launch_toml.processes.push(web); /// assert!(toml::to_string(&launch_toml).is_ok()); @@ -63,6 +64,8 @@ pub struct Process { pub command: String, pub args: Vec, pub direct: bool, + #[serde(default = "defaults::r#false")] + pub default: bool, } impl Process { @@ -71,12 +74,14 @@ impl Process { command: impl Into, args: impl IntoIterator>, direct: bool, + default: bool, ) -> Result { Ok(Process { r#type: ProcessType::from_str(r#type.as_ref())?, command: command.into(), args: args.into_iter().map(|i| i.into()).collect(), direct, + default, }) } }