good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pggat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gfx
pggat
Commits
03ef1800
Commit
03ef1800
authored
1 year ago
by
Garet Halliday
Browse files
Options
Downloads
Patches
Plain Diff
certs in DO mode
parent
62769f77
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/gat/modes/digitalocean_discovery/config.go
+25
-3
25 additions, 3 deletions
lib/gat/modes/digitalocean_discovery/config.go
with
25 additions
and
3 deletions
lib/gat/modes/digitalocean_discovery/config.go
+
25
−
3
View file @
03ef1800
...
...
@@ -28,9 +28,11 @@ import (
)
type
Config
struct
{
APIKey
string
`env:"PGGAT_DO_API_KEY"`
Private
string
`env:"PGGAT_DO_PRIVATE"`
PoolMode
string
`env:"PGGAT_POOL_MODE"`
APIKey
string
`env:"PGGAT_DO_API_KEY"`
Private
string
`env:"PGGAT_DO_PRIVATE"`
PoolMode
string
`env:"PGGAT_POOL_MODE"`
TLSCrtFile
string
`env:"PGGAT_TLS_CRT_FILE" default:"/etc/ssl/certs/pgbouncer.crt"`
TLSKeyFile
string
`env:"PGGAT_TLS_KEY_FILE" default:"/etc/ssl/certs/pgbouncer.key"`
}
func
Load
()
(
Config
,
error
)
{
...
...
@@ -44,6 +46,25 @@ func Load() (Config, error) {
}
func
(
T
*
Config
)
ListenAndServe
()
error
{
// load certificate
var
sslConfig
*
tls
.
Config
certificate
,
err
:=
tls
.
LoadX509KeyPair
(
T
.
TLSCrtFile
,
T
.
TLSKeyFile
)
if
err
==
nil
{
sslConfig
=
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
certificate
,
},
}
return
err
}
else
{
log
.
Printf
(
"failed to load certificate, ssl is disabled"
)
}
sslConfig
=
&
tls
.
Config
{
Certificates
:
[]
tls
.
Certificate
{
certificate
,
},
}
client
:=
godo
.
NewFromToken
(
T
.
APIKey
)
clusters
,
_
,
err
:=
client
.
Databases
.
List
(
context
.
Background
(),
nil
)
...
...
@@ -169,6 +190,7 @@ func (T *Config) ListenAndServe() error {
b
.
Queue
(
func
()
error
{
log
.
Print
(
"listening on :5432"
)
return
gat
.
ListenAndServe
(
"tcp"
,
":5432"
,
frontends
.
AcceptOptions
{
SSLConfig
:
sslConfig
,
AllowedStartupOptions
:
[]
strutil
.
CIString
{
strutil
.
MakeCIString
(
"client_encoding"
),
strutil
.
MakeCIString
(
"datestyle"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment