-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Load target env from other registry or local dir
Signed-off-by: itowlson <[email protected]>
- Loading branch information
Showing
4 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -58,7 +58,7 @@ pub struct AppDetails { | |
pub authors: Vec<String>, | ||
/// `targets = ["spin-2.5", "fermyon-cloud", "spinkube-0.4"]` | ||
#[serde(default, skip_serializing_if = "Vec::is_empty")] | ||
pub targets: Vec<String>, | ||
pub targets: Vec<TargetEnvironmentRef>, | ||
/// `[application.triggers.<type>]` | ||
#[serde(rename = "trigger", default, skip_serializing_if = "Map::is_empty")] | ||
pub trigger_global_configs: Map<String, toml::Table>, | ||
|
@@ -340,6 +340,27 @@ impl ComponentDependencies { | |
} | ||
} | ||
|
||
/// Identifies a deployment target. | ||
#[derive(Clone, Debug, Serialize, Deserialize)] | ||
#[serde(untagged, deny_unknown_fields)] | ||
pub enum TargetEnvironmentRef { | ||
/// Environment package reference e.g. `spin:[email protected]`. This is looked up | ||
/// in the default environment registry. | ||
DefaultRegistry(String), | ||
/// A target package in a registry other than the default | ||
Registry { | ||
/// Registry hosting the environment package e.g. `fermyon.com``. | ||
registry: String, | ||
/// Environment package reference e.g. `my:[email protected]`. | ||
package: String, | ||
}, | ||
/// A filesystem directory. This is expected to contain a WIT package. | ||
WitDirectory { | ||
/// The directory containing the environment WIT. | ||
path: PathBuf, | ||
}, | ||
} | ||
|
||
mod kebab_or_snake_case { | ||
use serde::{Deserialize, Serialize}; | ||
pub use spin_serde::{KebabId, SnakeId}; | ||
|