chore: add server data

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This commit is contained in:
Armando Ruocco 2024-09-26 12:17:19 +02:00
parent c5f9869c16
commit 1bd96b0126
2 changed files with 20 additions and 8 deletions

View File

@ -55,9 +55,15 @@ func main() {
Namespace: namespace, Namespace: namespace,
Name: boName, Name: boName,
}, },
// TODO: improve
PGDataPath: os.Getenv("PGDATA"), PGDataPath: os.Getenv("PGDATA"),
PGWALPath: os.Getenv("PGWAL"), PGWALPath: os.Getenv("PGWAL"),
SpoolDirectory: os.Getenv("SPOOL_DIRECTORY"), SpoolDirectory: os.Getenv("SPOOL_DIRECTORY"),
ServerCertPath: os.Getenv("SERVER_CERT"),
ServerKeyPath: os.Getenv("SERVER_KEY"),
ClientCertPath: os.Getenv("CLIENT_CERT"),
ServerAddress: os.Getenv("SERVER_ADDRESS"),
PluginPath: os.Getenv("PLUGIN_PATH"),
}); err != nil { }); err != nil {
setupLog.Error(err, "unable to create CNPGI runnable") setupLog.Error(err, "unable to create CNPGI runnable")
os.Exit(1) os.Exit(1)

View File

@ -15,6 +15,13 @@ type CNPGI struct {
PGDataPath string PGDataPath string
PGWALPath string PGWALPath string
SpoolDirectory string SpoolDirectory string
ServerCertPath string
ServerKeyPath string
ClientCertPath string
// mutually exclusive with pluginPath
ServerAddress string
// mutually exclusive with serverAddress
PluginPath string
} }
func (c *CNPGI) Start(ctx context.Context) error { func (c *CNPGI) Start(ctx context.Context) error {
@ -31,14 +38,13 @@ func (c *CNPGI) Start(ctx context.Context) error {
} }
srv := http.Server{ srv := http.Server{
IdentityImpl: IdentityImplementation{}, IdentityImpl: IdentityImplementation{},
Enrichers: []http.ServerEnricher{enrich}, Enrichers: []http.ServerEnricher{enrich},
// TODO: fille ServerCertPath: c.ServerCertPath,
ServerCertPath: "", ServerKeyPath: c.ServerKeyPath,
ServerKeyPath: "", ClientCertPath: c.ClientCertPath,
ClientCertPath: "", ServerAddress: c.ServerAddress,
ServerAddress: "", PluginPath: c.PluginPath,
PluginPath: "",
} }
return srv.Start(ctx) return srv.Start(ctx)