Skip to content

Commit

Permalink
Add POSTGRES_SSLMODE for gocoder (#760)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoriya authored Jan 4, 2025
1 parent 9be48de commit 3182cc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions transcoder/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ POSTGRES_PASSWORD=
POSTGRES_DB=
POSTGRES_SERVER=
POSTGRES_PORT=5432
# can also be "require" ("prefer" is not supported)
POSTGRES_SSLMODE="disable"
# Default is gocoder, you can specify "disabled" to use the default search_path of the user.
# If this is not "disabled", the schema will be created (if it does not exists) and
# the search_path of the user will be ignored (only the schema specified will be used).
Expand Down
3 changes: 2 additions & 1 deletion transcoder/src/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ type MetadataService struct {

func NewMetadataService() (*MetadataService, error) {
con := fmt.Sprintf(
"postgresql://%v:%v@%v:%v/%v?application_name=gocoder&sslmode=disable",
"postgresql://%v:%v@%v:%v/%v?application_name=gocoder&sslmode=%s",
url.QueryEscape(os.Getenv("POSTGRES_USER")),
url.QueryEscape(os.Getenv("POSTGRES_PASSWORD")),
url.QueryEscape(os.Getenv("POSTGRES_SERVER")),
url.QueryEscape(os.Getenv("POSTGRES_PORT")),
url.QueryEscape(os.Getenv("POSTGRES_DB")),
url.QueryEscape(GetEnvOr("POSTGRES_SSLMODE", "disable")),
)
schema := GetEnvOr("POSTGRES_SCHEMA", "gocoder")
if schema != "disabled" {
Expand Down

0 comments on commit 3182cc8

Please sign in to comment.