feat: remove service flag from expose command

yoonhyunwoo committed Nov 17, 2025 at 14:56 UTC ac3ed70e4179ff3d40820f063c8095f59c96f173
1 file changed +6 -16
cmd/portal-tunnel/main.go
+6 -16
@@ -19,7 +19,6 @@ import (
19
20 var (
21 flagConfigPath string
22 - flagService string
22 flagRelayURL string
23 flagHost string
24 flagPort string
@@ -42,7 +41,6 @@ func main() {
41 case "expose":
42 fs := flag.NewFlagSet("expose", flag.ExitOnError)
43 fs.StringVar(&flagConfigPath, "config", "", "Path to portal-tunnel config file")
45 - fs.StringVar(&flagService, "service", "", "Specific service name to expose (defaults to first entry)")
44 fs.StringVar(&flagRelayURL, "relay", "ws://localhost:4017/relay", "Portal relay server URL when config is not provided")
45 fs.StringVar(&flagHost, "host", "localhost", "Local host to proxy to when config is not provided")
46 fs.StringVar(&flagPort, "port", "4018", "Local port to proxy to when config is not provided")
@@ -65,7 +63,7 @@ func printTunnelUsage() {
63 fmt.Println("portal-tunnel — Expose local services through Portal relay")
64 fmt.Println()
65 fmt.Println("Usage:")
68 - fmt.Println(" portal-tunnel expose --config <file> [--service <name>]")
66 + fmt.Println(" portal-tunnel expose --config <file>")
67 fmt.Println(" portal-tunnel expose [--relay URL] [--host HOST] [--port PORT] [--name NAME]")
68 }
69
@@ -81,7 +79,7 @@ func runExposeWithConfig() error {
79 if err != nil {
80 return fmt.Errorf("load config: %w", err)
81 }
84 - services, err := selectServices(cfg, flagService)
82 + services, err := selectServices(cfg)
83 if err != nil {
84 return err
85 }
@@ -327,23 +325,15 @@ func runServiceTunnel(ctx context.Context, relayDir *RelayDirectory, service *Se
325 }
326 }
327
330 -func selectServices(cfg *TunnelConfig, name string) ([]*ServiceConfig, error) {
328 +func selectServices(cfg *TunnelConfig) ([]*ServiceConfig, error) {
329 if len(cfg.Services) == 0 {
330 return nil, fmt.Errorf("config has no services")
331 }
334 - if name == "" {
335 - services := make([]*ServiceConfig, len(cfg.Services))
336 - for i := range cfg.Services {
337 - services[i] = &cfg.Services[i]
338 - }
339 - return services, nil
340 - }
332 + services := make([]*ServiceConfig, len(cfg.Services))
333 for i := range cfg.Services {
342 - if cfg.Services[i].Name == name {
343 - return []*ServiceConfig{&cfg.Services[i]}, nil
344 - }
334 + services[i] = &cfg.Services[i]
335 }
346 - return nil, fmt.Errorf("service %q not found in config", name)
336 + return services, nil
337 }
338
339 func extractHost(wsURL string) string {