Skip to content

Commit a3c8e08

Browse files
make port configurable
1 parent 59990d8 commit a3c8e08

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

boundary.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type Config struct {
2020
TLSConfig *tls.Config
2121
Logger *slog.Logger
2222
Jailer jail.Jailer
23+
ProxyPort int
2324
}
2425

2526
type Boundary struct {
@@ -34,7 +35,7 @@ type Boundary struct {
3435
func New(ctx context.Context, config Config) (*Boundary, error) {
3536
// Create proxy server
3637
proxyServer := proxy.NewProxyServer(proxy.Config{
37-
HTTPPort: 8087,
38+
HTTPPort: config.ProxyPort,
3839
RuleEngine: config.RuleEngine,
3940
Auditor: config.Auditor,
4041
Logger: config.Logger,

cli/cli.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Config struct {
2828
LogLevel string
2929
LogDir string
3030
Unprivileged bool
31+
ProxyPort int64
3132
}
3233

3334
// NewCommand creates and returns the root serpent command
@@ -86,6 +87,13 @@ func BaseCommand() *serpent.Command {
8687
Description: "Run in unprivileged mode (no network isolation, uses proxy environment variables).",
8788
Value: serpent.BoolOf(&config.Unprivileged),
8889
},
90+
{
91+
Flag: "proxy-port",
92+
Env: "PROXY_PORT",
93+
Description: "Set a port for HTTP proxy.",
94+
Default: "8080",
95+
Value: serpent.Int64Of(&config.ProxyPort),
96+
},
8997
},
9098
Handler: func(inv *serpent.Invocation) error {
9199
args := inv.Args
@@ -181,7 +189,7 @@ func Run(ctx context.Context, config Config, args []string) error {
181189
// Create jailer with cert path from TLS setup
182190
jailer, err := createJailer(jail.Config{
183191
Logger: logger,
184-
HttpProxyPort: 8087,
192+
HttpProxyPort: int(config.ProxyPort),
185193
Username: username,
186194
Uid: uid,
187195
Gid: gid,
@@ -200,6 +208,7 @@ func Run(ctx context.Context, config Config, args []string) error {
200208
TLSConfig: tlsConfig,
201209
Logger: logger,
202210
Jailer: jailer,
211+
ProxyPort: int(config.ProxyPort),
203212
})
204213
if err != nil {
205214
return fmt.Errorf("failed to create boundary instance: %v", err)

0 commit comments

Comments
 (0)