From 61da30f44a1263582607ec8723ff203f44ca2756 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Wed, 18 Oct 2023 12:45:49 +0100 Subject: [PATCH] Allow configuring wazero. --- .github/workflows/go.yml | 8 ++++---- sqlite.go | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 67f79de..30ece3c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: lfs: 'true' @@ -56,9 +56,9 @@ jobs: - name: Coverage report uses: ncruces/go-coverage-report@v0 with: - chart: 'true' - amend: 'true' - reuse-go: 'true' + chart: true + amend: true + reuse-go: true if: | github.event_name == 'push' && matrix.os == 'ubuntu-latest' diff --git a/sqlite.go b/sqlite.go index 8a9a65d..ce9966f 100644 --- a/sqlite.go +++ b/sqlite.go @@ -22,6 +22,8 @@ import ( var ( Binary []byte // WASM binary to load. Path string // Path to load the binary from. + + RuntimeConfig wazero.RuntimeConfig ) var instance struct { @@ -32,8 +34,12 @@ var instance struct { } func compileSQLite() { + if RuntimeConfig == nil { + RuntimeConfig = wazero.NewRuntimeConfig() + } + ctx := context.Background() - instance.runtime = wazero.NewRuntime(ctx) + instance.runtime = wazero.NewRuntimeWithConfig(ctx, RuntimeConfig) env := instance.runtime.NewHostModuleBuilder("env") env = vfs.ExportHostFunctions(env)