| 37 | } |
| 38 | |
| 39 | func validateEnvironmentVars(opts *build.BuildOpts) error { |
| 40 | scaffoldPath := os.Getenv(EnvTsunamiScaffoldPath) |
| 41 | if scaffoldPath == "" { |
| 42 | return fmt.Errorf("%s environment variable must be set", EnvTsunamiScaffoldPath) |
| 43 | } |
| 44 | absScaffoldPath, err := filepath.Abs(scaffoldPath) |
| 45 | if err != nil { |
| 46 | return fmt.Errorf("failed to resolve %s to absolute path: %w", EnvTsunamiScaffoldPath, err) |
| 47 | } |
| 48 | |
| 49 | sdkReplacePath := os.Getenv(EnvTsunamiSdkReplacePath) |
| 50 | if sdkReplacePath == "" { |
| 51 | return fmt.Errorf("%s environment variable must be set", EnvTsunamiSdkReplacePath) |
| 52 | } |
| 53 | absSdkReplacePath, err := filepath.Abs(sdkReplacePath) |
| 54 | if err != nil { |
| 55 | return fmt.Errorf("failed to resolve %s to absolute path: %w", EnvTsunamiSdkReplacePath, err) |
| 56 | } |
| 57 | |
| 58 | opts.ScaffoldPath = absScaffoldPath |
| 59 | opts.SdkReplacePath = absSdkReplacePath |
| 60 | |
| 61 | // NodePath is optional |
| 62 | if nodePath := os.Getenv(EnvTsunamiNodePath); nodePath != "" { |
| 63 | opts.NodePath = nodePath |
| 64 | } |
| 65 | |
| 66 | return nil |
| 67 | } |
| 68 | |
| 69 | var buildCmd = &cobra.Command{ |
| 70 | Use: "build [apppath]", |