chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / po / pomerium / 0001-envoy-allow-specification-of-external-binary.patch
blobd43242b6cc14eaba647427befa82f66203b945f1
1 From e82f2949b86d127aec908d90d872dfd6feb509e5 Mon Sep 17 00:00:00 2001
2 From: Morgan Helton <mhelton@gmail.com>
3 Date: Sun, 26 May 2024 12:17:01 -0500
4 Subject: [PATCH] envoy: allow specification of external binary
6 ---
7 pkg/envoy/envoy.go | 17 ++++++++++-------
8 1 file changed, 10 insertions(+), 7 deletions(-)
10 diff --git a/pkg/envoy/envoy.go b/pkg/envoy/envoy.go
11 index 6639d4bd..c6ca198f 100644
12 --- a/pkg/envoy/envoy.go
13 +++ b/pkg/envoy/envoy.go
14 @@ -8,9 +8,9 @@ import (
15 "errors"
16 "fmt"
17 "io"
18 + "io/fs"
19 "os"
20 "os/exec"
21 - "path"
22 "path/filepath"
23 "regexp"
24 "strconv"
25 @@ -34,8 +34,12 @@ import (
27 const (
28 configFileName = "envoy-config.yaml"
29 + workingDirectoryName = ".pomerium-envoy"
30 + embeddedEnvoyPermissions fs.FileMode = 0o700
33 +var OverrideEnvoyPath = ""
35 type serverOptions struct {
36 services string
37 logLevel config.LogLevel
38 @@ -59,17 +63,16 @@ type Server struct {
40 // NewServer creates a new server with traffic routed by envoy.
41 func NewServer(ctx context.Context, src config.Source, builder *envoyconfig.Builder) (*Server, error) {
42 - if err := preserveRlimitNofile(); err != nil {
43 - log.Debug(ctx).Err(err).Msg("couldn't preserve RLIMIT_NOFILE before starting Envoy")
44 - }
45 + envoyPath := OverrideEnvoyPath
46 + wd := filepath.Join(os.TempDir(), workingDirectoryName)
48 - envoyPath, err := Extract()
49 + err := os.MkdirAll(wd, embeddedEnvoyPermissions)
50 if err != nil {
51 - return nil, fmt.Errorf("extracting envoy: %w", err)
52 + return nil, fmt.Errorf("error creating temporary working directory for envoy: %w", err)
55 srv := &Server{
56 - wd: path.Dir(envoyPath),
57 + wd: wd,
58 builder: builder,
59 grpcPort: src.GetConfig().GRPCPort,
60 httpPort: src.GetConfig().HTTPPort,
61 --
62 2.46.0