Skip to content

Commit

Permalink
Merge pull request #1949 from itowlson/m2-template-all-the-things-let…
Browse files Browse the repository at this point in the history
…s-go

Update remaining templates to manifest v2
  • Loading branch information
itowlson authored Oct 25, 2023
2 parents 94109b5 + 6b51a7f commit aaec0f6
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 84 deletions.
22 changes: 12 additions & 10 deletions templates/http-c/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[component]]
id = "{{project-name | kebab_case}}"
source = "main.wasm"
allowed_http_hosts = []
[component.trigger]
[[trigger.http]]
route = "{{http-path}}"
component = "{{project-name | kebab_case}}"
executor = { type = "wagi" }
[component.build]

[component.{{project-name | kebab_case}}]
source = "main.wasm"
allowed_http_hosts = []
[component.{{project-name | kebab_case}}.build]
command = "zig build-exe -O ReleaseSmall -target wasm32-wasi main.c -lc"
watch = ["**/*.c"]
1 change: 0 additions & 1 deletion templates/http-c/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ tags = ["http", "c"]

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
22 changes: 12 additions & 10 deletions templates/http-grain/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[component]]
id = "{{project-name | kebab_case}}"
source = "main.wasm"
allowed_http_hosts = []
[component.trigger]
[[trigger.http]]
route = "{{http-path}}"
component = "{{project-name | kebab_case}}"
executor = { type = "wagi" }
[component.build]

[component.{{project-name | kebab_case}}]
source = "main.wasm"
allowed_http_hosts = []
[component.{{project-name | kebab_case}}.build]
command = "grain compile --release -o main.wasm main.gr"
watch = ["**/*.gr"]
1 change: 0 additions & 1 deletion templates/http-grain/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ tags = ["http", "grain"]

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
22 changes: 12 additions & 10 deletions templates/http-php/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[component]]
id = "{{project-name | kebab_case}}"
[[trigger.http]]
route = "{{http-path}}"
component = "{{project-name | kebab_case}}"
executor = { type = "wagi"}

[component.{{project-name | kebab_case}}]
files = [ { source = "./src", destination = "/" } ]
allowed_http_hosts = []
[component.source]
[component.{{project-name | kebab_case}}.source]
url = "https://github.com/vmware-labs/webassembly-language-runtimes/releases/download/php%2F7.4.32%2B20221124-2159d1c/php-cgi-7.4.32.speed-optimized.wasm"
digest = "sha256:511720698dee56134ed8a08a87131d33c3ea8a64b6726cd6710d624bca4ceb6c"
[component.trigger]
executor = { type = "wagi"}
route = "{{http-path}}"
1 change: 0 additions & 1 deletion templates/http-php/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ tags = ["http", "php"]

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
22 changes: 12 additions & 10 deletions templates/http-swift/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[component]]
id = "{{project-name | kebab_case}}"
source = "main.wasm"
allowed_http_hosts = []
[component.trigger]
[[trigger.http]]
route = "{{http-path}}"
component = "{{project-name | kebab_case}}"
executor = { type = "wagi" }
[component.build]

[component.{{project-name | kebab_case}}]
source = "main.wasm"
allowed_http_hosts = []
[component.{{project-name | kebab_case}}.build]
command = "swiftc -target wasm32-unknown-wasi main.swift -o main.wasm"
watch = ["**/*.swift"]
1 change: 0 additions & 1 deletion templates/http-swift/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ tags = ["http", "swift"]

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
22 changes: 12 additions & 10 deletions templates/http-zig/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[component]]
id = "{{project-name | kebab_case}}"
source = "main.wasm"
allowed_http_hosts = []
[component.trigger]
[[trigger.http]]
route = "{{http-path}}"
component = "{{project-name | kebab_case}}"
executor = { type = "wagi" }
[component.build]

[component.{{project-name | kebab_case}}]
source = "main.wasm"
allowed_http_hosts = []
[component.{{project-name | kebab_case}}.build]
command = "zig build-exe -O ReleaseSmall -target wasm32-wasi src/main.zig"
watch = ["src/**/*.zig"]
1 change: 0 additions & 1 deletion templates/http-zig/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ tags = ["http", "zig"]

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
18 changes: 10 additions & 8 deletions templates/redirect/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[trigger.http]]
route = "{{ redirect-from }}"
component = "{{project-name | kebab_case}}"

[[component]]
[component.{{project-name | kebab_case}}]
source = { url = "https://github.com/fermyon/spin-redirect/releases/download/v0.1.0/redirect.wasm", digest = "sha256:8bee959843f28fef2a02164f5840477db81d350877e1c22cb524f41363468e52" }
id = "{{ project-name | kebab_case }}"
environment = { DESTINATION = "{{ redirect-to }}" }
[component.trigger]
route = "{{ redirect-from }}"
9 changes: 5 additions & 4 deletions templates/redirect/metadata/snippets/component.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[[component]]
[[trigger.http]]
route = "{{ redirect-from }}"
component = "{{project-name | kebab_case}}"

[component.{{project-name | kebab_case}}]
source = { url = "https://github.com/fermyon/spin-redirect/releases/download/v0.1.0/redirect.wasm", digest = "sha256:8bee959843f28fef2a02164f5840477db81d350877e1c22cb524f41363468e52" }
id = "{{ project-name | kebab_case }}"
environment = { DESTINATION = "{{ redirect-to }}" }
[component.trigger]
route = "{{ redirect-from }}"
3 changes: 1 addition & 2 deletions templates/redirect/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ tags = ["redirect"]

[add_component]
skip_files = ["spin.toml"]
skip_parameters = ["project-description", "http-base"]
skip_parameters = ["project-description"]
[add_component.snippets]
component = "component.txt"

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
redirect-from = { type = "string", prompt = "Redirect from", pattern = "^/\\S*$" }
redirect-to = { type = "string", prompt = "Redirect to" }
18 changes: 10 additions & 8 deletions templates/static-fileserver/content/spin.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
spin_manifest_version = "1"
authors = ["{{authors}}"]
description = "{{project-description}}"
spin_manifest_version = 2

[application]
name = "{{project-name}}"
trigger = { type = "http", base = "{{http-base}}" }
version = "0.1.0"
authors = ["{{authors}}"]
description = "{{project-description}}"

[[trigger.http]]
route = "{{ http-path | http_wildcard }}"
component = "{{project-name | kebab_case}}"

[[component]]
[component.{{project-name | kebab_case}}]
source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.1.0/spin_static_fs.wasm", digest = "sha256:96c76d9af86420b39eb6cd7be5550e3cb5d4cc4de572ce0fd1f6a29471536cb4" }
id = "{{ project-name }}"
files = [{ source = "{{ files-path }}", destination = "/" }]
[component.trigger]
route = "{{ http-path | http_wildcard }}"
11 changes: 6 additions & 5 deletions templates/static-fileserver/metadata/snippets/component.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[[component]]
source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.1.0/spin_static_fs.wasm", digest = "sha256:96c76d9af86420b39eb6cd7be5550e3cb5d4cc4de572ce0fd1f6a29471536cb4" }
id = "{{ project-name }}"
files = [ { source = "{{ files-path }}", destination = "/" } ]
[component.trigger]
[[trigger.http]]
route = "{{ http-path | http_wildcard }}"
component = "{{project-name | kebab_case}}"

[component.{{project-name | kebab_case}}]
source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.1.0/spin_static_fs.wasm", digest = "sha256:96c76d9af86420b39eb6cd7be5550e3cb5d4cc4de572ce0fd1f6a29471536cb4" }
files = [{ source = "{{ files-path }}", destination = "/" }]
3 changes: 1 addition & 2 deletions templates/static-fileserver/metadata/spin-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ tags = ["http", "file", "static", "asset"]

[add_component]
skip_files = ["spin.toml", ".gitignore"]
skip_parameters = ["http-base", "project-description"]
skip_parameters = ["project-description"]
[add_component.snippets]
component = "component.txt"

[parameters]
project-description = { type = "string", prompt = "Description", default = "" }
http-base = { type = "string", prompt = "HTTP base", default = "/", pattern = "^/\\S*$" }
http-path = { type = "string", prompt = "HTTP path", default = "/static/...", pattern = "^/\\S*$" }
files-path = { type = "string", prompt = "Directory containing the files to serve", default = "assets", pattern = "^\\S+$" }

0 comments on commit aaec0f6

Please sign in to comment.