From 4e13526e53b5a81316a907967fa413457f005ca5 Mon Sep 17 00:00:00 2001 From: Andrew Steurer Date: Fri, 12 Jul 2024 14:53:10 -0600 Subject: [PATCH] fixing bug in main application, and attempting another caching strategy Signed-off-by: Andrew Steurer --- .github/workflows/build-package.yaml | 21 +++++++++++++++++++-- infra/main.tf | 2 +- infra/variables.tf | 4 ++++ main.go | 4 +++- spin.toml | 2 +- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-package.yaml b/.github/workflows/build-package.yaml index 78a4f6a..6b29db7 100644 --- a/.github/workflows/build-package.yaml +++ b/.github/workflows/build-package.yaml @@ -31,8 +31,25 @@ jobs: - name: cofiguring rust toolchain version run: rustup toolchain install stable --profile minimal - - name: setting up the cache - uses: Swatinem/rust-cache@v2 + - name: cache cargo registry and git index + id: cache-cargo-registry + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('install-script.sh') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: cache cargo binaries + id: cache-cargo-bin + uses: actions/cache@v3 + with: + path: ~/.cargo/bin + key: ${{ runner.os }}-cargo-bin-${{ hashFiles('install-script.sh') }} + restore-keys: | + ${{ runner.os }}-cargo-bin- - name: install wkg run: cargo install --git https://github.com/bytecodealliance/wasm-pkg-tools wkg --locked --config net.git-fetch-with-cli=true diff --git a/infra/main.tf b/infra/main.tf index 9abafa1..ff6798d 100644 --- a/infra/main.tf +++ b/infra/main.tf @@ -24,7 +24,7 @@ locals { resource "azurerm_resource_group" "demo" { name = "rg-${local.base_name}" - location = "West US 2" + location = var.location } resource "azurerm_storage_account" "demo" { diff --git a/infra/variables.tf b/infra/variables.tf index 2abb954..3c9eab4 100644 --- a/infra/variables.tf +++ b/infra/variables.tf @@ -2,6 +2,10 @@ variable "prefix" { type = string } +variable "location" { + type = string +} + variable "tags" { description = "Map of extra tags to attach to items which accept them" type = map(string) diff --git a/main.go b/main.go index 776ef17..429e553 100644 --- a/main.go +++ b/main.go @@ -43,7 +43,9 @@ func init() { return } - uriPath := r.URL.Path + // This gets the vital portions of the uri path, while excluding the route path defined in the spin.toml file + //See https://developer.fermyon.com/spin/v2/http-trigger#additional-request-information + uriPath := r.Header.Get("spin-path-info") queryString := r.URL.RawQuery endpoint := fmt.Sprintf("https://%s.%s.core.windows.net", accountName, service) diff --git a/spin.toml b/spin.toml index b7ce997..60031f8 100644 --- a/spin.toml +++ b/spin.toml @@ -12,7 +12,7 @@ az_shared_key = { required = true, secret = true } [[trigger.http]] -route = "/azure-client/..." +route = "/..." component = "go-azure" [component.go-azure]