77 "net"
88 "net/http"
99 "os"
10+ "path/filepath"
1011 "strconv"
1112 "sync"
1213 "time"
@@ -55,22 +56,20 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
5556 return nil , err
5657 }
5758
58- if options .WASMStorageDir == "" {
59- return nil , E .New ("provided an empty storage directory for WASM files" )
59+ if options .Dir == "" {
60+ return nil , E .New ("provided an empty storage directory for WATER files" )
6061 }
6162
62- if options .WazeroCompilationCacheDir == "" {
63- return nil , E .New ("provided an empty storage directory for wazero compilation cache" )
64- }
65-
66- for _ , dir := range []string {options .WASMStorageDir , options .WazeroCompilationCacheDir } {
63+ wasmDir := filepath .Join (options .Dir , "wasm_files" )
64+ wazeroCompilationDir := filepath .Join (options .Dir , "wazero_compilation_cache" )
65+ for _ , dir := range []string {wasmDir , wazeroCompilationDir } {
6766 if err := os .MkdirAll (dir , 0755 ); err != nil {
6867 return nil , err
6968 }
7069 }
7170
7271 slogLogger := slog .New (L .NewLogHandler (logger ))
73- vc := waterVC .NewWaterVersionControl (options . WASMStorageDir , slogLogger )
72+ vc := waterVC .NewWaterVersionControl (wasmDir , slogLogger )
7473 d , err := waterDownloader .NewWASMDownloader (options .WASMAvailableAt , & http.Client {Timeout : timeout })
7574 if err != nil {
7675 return nil , E .New ("failed to create WASM downloader" , err )
@@ -95,7 +94,7 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
9594
9695 // We're creating the compilation cache dir and setting the global value so during runtime
9796 // it won't need to create one at a temp directory
98- compilationCache , err := wazero .NewCompilationCacheWithDir (options . WazeroCompilationCacheDir )
97+ compilationCache , err := wazero .NewCompilationCacheWithDir (wazeroCompilationDir )
9998 if err != nil {
10099 return nil , err
101100 }
0 commit comments