Skip to content

Commit fef2ab9

Browse files
authored
Merge pull request #1921 from itowlson/templates-more-manifest-v2
Update redis-* and http-go templates
2 parents e1e6e7f + a683056 commit fef2ab9

File tree

8 files changed

+53
-45
lines changed

8 files changed

+53
-45
lines changed

crates/templates/src/manager.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,9 @@ mod tests {
869869
{
870870
let template = manager.get("http-empty").unwrap().unwrap();
871871

872-
let values = [
873-
("project-description".to_owned(), "my desc".to_owned()),
874-
("http-base".to_owned(), "/".to_owned()),
875-
]
876-
.into_iter()
877-
.collect();
872+
let values = [("project-description".to_owned(), "my desc".to_owned())]
873+
.into_iter()
874+
.collect();
878875
let options = RunOptions {
879876
variant: crate::template::TemplateVariantInfo::NewApplication,
880877
output_path: application_dir.clone(),
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
spin_manifest_version = "1"
2-
authors = ["{{authors}}"]
3-
description = "{{project-description}}"
1+
spin_manifest_version = 2
2+
3+
[application]
44
name = "{{project-name}}"
5-
trigger = { type = "http", base = "{{http-base}}" }
65
version = "0.1.0"
6+
authors = ["{{authors}}"]
7+
description = "{{project-description}}"

templates/http-empty/metadata/spin-template.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ tags = ["http"]
55

66
[parameters]
77
project-description = { type = "string", prompt = "Description", default = "" }
8-
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
spin_manifest_version = "1"
2-
authors = ["{{authors}}"]
3-
description = "{{project-description}}"
1+
spin_manifest_version = 2
2+
3+
[application]
44
name = "{{project-name}}"
5-
trigger = { type = "http", base = "{{http-base}}" }
65
version = "0.1.0"
6+
authors = ["{{authors}}"]
7+
description = "{{project-description}}"
8+
9+
[[trigger.http]]
10+
route = "{{http-path}}"
11+
component = "{{project-name | kebab_case}}"
712

8-
[[component]]
9-
id = "{{project-name | kebab_case}}"
13+
[component.{{project-name | kebab_case}}]
1014
source = "main.wasm"
1115
allowed_http_hosts = []
12-
[component.trigger]
13-
route = "{{http-path}}"
14-
[component.build]
16+
[component.{{project-name | kebab_case}}.build]
1517
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
1618
watch = ["**/*.go", "go.mod"]
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
[[component]]
2-
id = "{{project-name | kebab_case}}"
1+
[[trigger.http]]
2+
route = "{{http-path}}"
3+
component = "{{project-name | kebab_case}}"
4+
5+
[component.{{project-name | kebab_case}}]
36
source = "{{ output-path }}/main.wasm"
47
allowed_http_hosts = []
5-
[component.trigger]
6-
route = "{{http-path}}"
7-
[component.build]
8+
[component.{{project-name | kebab_case}}.build]
89
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
910
workdir = "{{ output-path }}"
1011
watch = ["**/*.go", "go.mod"]

templates/http-go/metadata/spin-template.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ tags = ["http", "go"]
55

66
[add_component]
77
skip_files = ["spin.toml"]
8-
skip_parameters = ["http-base"]
98
[add_component.snippets]
109
component = "component.txt"
1110

1211
[parameters]
1312
project-description = { type = "string", prompt = "Description", default = "" }
14-
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
1513
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
spin_manifest_version = "1"
2-
authors = ["{{authors}}"]
3-
description = "{{project-description}}"
1+
spin_manifest_version = 2
2+
3+
[application]
44
name = "{{project-name}}"
5-
trigger = { type = "redis", address = "{{redis-address}}" }
65
version = "0.1.0"
6+
authors = ["{{authors}}"]
7+
description = "{{project-description}}"
78

8-
[[component]]
9-
id = "{{project-name | kebab_case}}"
9+
[application.trigger.redis]
10+
address = "{{redis-address}}"
11+
12+
[[trigger.redis]]
13+
channel = "{{redis-channel}}"
14+
component = "{{project-name | kebab_case}}"
15+
16+
[component.{{project-name | kebab_case}}]
1017
source = "main.wasm"
1118
allowed_http_hosts = []
12-
[component.trigger]
13-
channel = "{{redis-channel}}"
14-
[component.build]
19+
[component.{{project-name | kebab_case}}.build]
1520
command = "tinygo build -target=wasi -gc=leaking -no-debug -o main.wasm main.go"
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
spin_manifest_version = "1"
2-
authors = ["{{authors}}"]
3-
description = "{{project-description}}"
1+
spin_manifest_version = 2
2+
3+
[application]
44
name = "{{project-name}}"
5-
trigger = { type = "redis", address = "{{redis-address}}" }
65
version = "0.1.0"
6+
authors = ["{{authors}}"]
7+
description = "{{project-description}}"
78

8-
[[component]]
9-
id = "{{project-name | kebab_case}}"
9+
[application.trigger.redis]
10+
address = "{{redis-address}}"
11+
12+
[[trigger.redis]]
13+
channel = "{{redis-channel}}"
14+
component = "{{project-name | kebab_case}}"
15+
16+
[component.{{project-name | kebab_case}}]
1017
source = "target/wasm32-wasi/release/{{project-name | snake_case}}.wasm"
1118
allowed_http_hosts = []
12-
[component.trigger]
13-
channel = "{{redis-channel}}"
14-
[component.build]
19+
[component.{{project-name | kebab_case}}.build]
1520
command = "cargo build --target wasm32-wasi --release"

0 commit comments

Comments
 (0)