solidblocks icon indicating copy to clipboard operation
solidblocks copied to clipboard

Multiline DB_POSTGRES_EXTRA_CONFIG results in invalid config

Open JonasHiltl opened this issue 6 months ago • 2 comments

I want to define multiple extra configs for the postgresql.conf through the DB_POSTGRES_EXTRA_CONFIG environment variable. But when using a multiline yaml string the line breaks are missing in the resulting postgresql.conf thus the config is invalid and Postgres crashes with following error:

LOG:  syntax error in file "/storage/data/ocl/15/postgresql.conf" line 17, near token "\"

This is the extra config I want to apply:

environment:
  DB_POSTGRES_EXTRA_CONFIG: |
    max_connections = 200
    shared_buffers = 2GB
    effective_cache_size = 6GB
    maintenance_work_mem = 512MB
    checkpoint_completion_target = 0.9
    wal_buffers = 16MB
    default_statistics_target = 100
    random_page_cost = 1.1
    effective_io_concurrency = 200
    work_mem = 5242kB
    huge_pages = off
    min_wal_size = 1GB
    max_wal_size = 4GB

This is the resulting postgresql.conf


archive_command = 'pgbackrest --config /rds/config/pgbackrest.conf --log-level-console=info --log-path=/rds/log --stanza=ocl archive-push  %p'
archive_mode = on


max_wal_senders = 3
wal_level = replica

listen_addresses = '*'
unix_socket_directories =  '/rds/socket'
log_destination = 'stderr'
logging_collector = 'off'
log_line_prefix = '%h %m [%p] %q%u@%d '



max_connections = 200\nshared_buffers = 2GB\neffective_cache_size = 6GB\nmaintenance_work_mem = 512MB\ncheckpoint_completion_target = 0.9\nwal_buffers = 16MB\ndefault_statistics_target = 100\nrandom_page_cost = 1.1\neffective_io_concurrency = 200\nwork_mem = 5242kB\nhuge_pages = off\nmin_wal_size = 1GB\nmax_wal_size = 4GB\n

JonasHiltl avatar Aug 21 '24 14:08 JonasHiltl