@@ -217,7 +217,7 @@ func (c *TsunamiController) Start(ctx context.Context, blockMeta waveobj.MetaMap
217217 return fmt .Errorf ("app cache is not executable: %s" , cachePath )
218218 }
219219
220- tsunamiProc , err := runTsunamiAppBinary (ctx , cachePath , appPath )
220+ tsunamiProc , err := runTsunamiAppBinary (ctx , cachePath , appPath , blockMeta )
221221 if err != nil {
222222 return fmt .Errorf ("failed to run tsunami app: %w" , err )
223223 }
@@ -300,10 +300,18 @@ func (c *TsunamiController) SendInput(input *BlockInputUnion) error {
300300 return fmt .Errorf ("tsunami controller send input not implemented" )
301301}
302302
303- func runTsunamiAppBinary (ctx context.Context , appBinPath string , appPath string ) (* TsunamiAppProc , error ) {
303+ func runTsunamiAppBinary (ctx context.Context , appBinPath string , appPath string , blockMeta waveobj. MetaMapType ) (* TsunamiAppProc , error ) {
304304 cmd := exec .Command (appBinPath )
305305 cmd .Env = append (os .Environ (), "TSUNAMI_CLOSEONSTDIN=1" )
306306
307+ // Add TsunamiEnv variables if configured
308+ tsunamiEnv := blockMeta .GetMap (waveobj .MetaKey_TsunamiEnv )
309+ for key , value := range tsunamiEnv {
310+ if strValue , ok := value .(string ); ok {
311+ cmd .Env = append (cmd .Env , key + "=" + strValue )
312+ }
313+ }
314+
307315 stdoutPipe , err := cmd .StdoutPipe ()
308316 if err != nil {
309317 return nil , fmt .Errorf ("failed to create stdout pipe: %w" , err )
@@ -320,12 +328,12 @@ func runTsunamiAppBinary(ctx context.Context, appBinPath string, appPath string)
320328 }
321329
322330 appName := build .GetAppName (appPath )
323-
331+
324332 stdoutBuffer := utilds .MakeReaderLineBuffer (stdoutPipe , 1000 )
325333 stdoutBuffer .SetLineCallback (func (line string ) {
326334 log .Printf ("[tsunami:%s] %s\n " , appName , line )
327335 })
328-
336+
329337 stderrBuffer := utilds .MakeReaderLineBuffer (stderrPipe , 1000 )
330338 stderrBuffer .SetLineCallback (func (line string ) {
331339 log .Printf ("[tsunami:%s] %s\n " , appName , line )
0 commit comments