()
| 60 | } |
| 61 | |
| 62 | func (r *RootCmd) boundary() *serpent.Command { |
| 63 | version := getBoundaryVersion() |
| 64 | cmd := boundarycli.BaseCommand(version) // Package coder/boundary/cli exports a "base command" designed to be integrated as a subcommand. |
| 65 | cmd.Use += " [args...]" // The base command looks like `boundary -- command`. Serpent adds the flags piece, but we need to add the args. |
| 66 | |
| 67 | // Wrap the handler to check for FeatureBoundary entitlement. |
| 68 | originalHandler := cmd.Handler |
| 69 | cmd.Handler = func(inv *serpent.Invocation) error { |
| 70 | // Boundary re-executes itself with CHILD=true to run the target process |
| 71 | // inside a jailed network namespace. Skip the license check for child |
| 72 | // processes since the parent already verified entitlement. |
| 73 | if isChild() { |
| 74 | return originalHandler(inv) |
| 75 | } |
| 76 | |
| 77 | if err := r.verifyLicense(inv); err != nil { |
| 78 | return err |
| 79 | } |
| 80 | |
| 81 | // Call the original handler if entitlement check passes. |
| 82 | return originalHandler(inv) |
| 83 | } |
| 84 | |
| 85 | return cmd |
| 86 | } |
no test coverage detected