Skip to content

Commit

Permalink
fix: unknown resource type (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
oddgrd authored Mar 26, 2023
1 parent a69dc27 commit d8fdc2b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions deployer/src/persistence/resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Display for Type {
match self {
Type::Database(db_type) => write!(f, "database::{db_type}"),
Type::Secrets => write!(f, "secrets"),
Type::StaticFolder => write!(f, "static folder"),
Type::StaticFolder => write!(f, "static_folder"),
Type::Persist => write!(f, "persist"),
}
}
Expand All @@ -87,7 +87,12 @@ impl FromStr for Type {
_ => Err(format!("'{prefix}' is an unknown resource type")),
}
} else {
Err(format!("'{s}' is an unknown resource type"))
match s {
"secrets" => Ok(Self::Secrets),
"static_folder" => Ok(Self::StaticFolder),
"persist" => Ok(Self::Persist),
_ => Err(format!("'{s}' is an unknown resource type")),
}
}
}
}
Expand Down Expand Up @@ -131,6 +136,9 @@ mod tests {
Type::Database(database::Type::AwsRds(database::AwsRdsType::MariaDB)),
Type::Database(database::Type::Shared(database::SharedType::Postgres)),
Type::Database(database::Type::Shared(database::SharedType::MongoDb)),
Type::Secrets,
Type::StaticFolder,
Type::Persist,
];

for input in inputs {
Expand Down

0 comments on commit d8fdc2b

Please sign in to comment.