Skip to content

Commit

Permalink
Merge pull request #2042 from fermyon/allow-http-and-https
Browse files Browse the repository at this point in the history
  • Loading branch information
rylev authored Nov 5, 2023
2 parents 7ce2c4b + af6949e commit 008546b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 7 additions & 7 deletions crates/manifest/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ pub(crate) fn convert_allowed_http_to_allowed_hosts(
"http://self".into(),
]),
AllowedHttpHosts::AllowSpecific(specific) => {
outbound_hosts.extend(specific.into_iter().map(|s| {
outbound_hosts.extend(specific.into_iter().flat_map(|s| {
if s.domain == "self" {
"http://self".into()
vec!["http://self".into()]
} else {
let port = match s.port {
Some(p) => p.to_string(),
None => "443".to_string(),
};
format!("https://{}:{}", s.domain, port)
let port = s.port.map(|p| format!(":{p}")).unwrap_or_default();
vec![
format!("http://{}{}", s.domain, port),
format!("https://{}{}", s.domain, port),
]
}
}))
}
Expand Down
3 changes: 2 additions & 1 deletion crates/manifest/tests/ui/v1/maximal.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
],
"allowed_outbound_hosts": [
"https://fermyon.com:443",
"https://example.com:443"
"http://example.com",
"https://example.com"
],
"key_value_stores": [
"default"
Expand Down
2 changes: 1 addition & 1 deletion crates/manifest/tests/ui/v1/maximal.toml.v2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ allowed_outbound_hosts = ["redis://*:*", "mysql://*:*", "postgres://*:*"]
description = "My fine component"
files = ["pattern/*", { source = "placement", destination = "/" }]
exclude_files = ["**/secret"]
allowed_outbound_hosts = ["https://fermyon.com:443", "https://example.com:443"]
allowed_outbound_hosts = ["https://fermyon.com:443", "http://example.com", "https://example.com"]
key_value_stores = ["default"]
sqlite_databases = ["default"]
ai_models = ["llama2-chat"]
Expand Down

0 comments on commit 008546b

Please sign in to comment.