Skip to content

If you're encountering an error like: Error: postgres: querying system variables: pq: SSL is not enabled on the server #3478

Closed Answered by letavocado
letavocado asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @a8m! Thank you for useful link. Yes I know, but in this doc https://atlasgo.io/faq/dotenv-files we see this example:

locals {
    envfile = {
        for line in split("\n", file(var.envfile)): split("=", line)[0] => regex("=(.*)", line)[0]
        if !startswith(line, "#") && length(split("=", line)) > 1
    }
}

and this works for simple KEY=VALUE pairs but fails when a value contains an = itself, like in query strings or URLs

so I provided solution that supports query strings

locals {
  envfile = {
    for line in split("\n", file(var.envfile)) :
    trimspace(slice(split("=", line), 0, 1)[0]) => trimspace(join("=", slice(split("=", line), 1, length(split("=", line)))))
    if !sta…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@letavocado
Comment options

Answer selected by letavocado
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants