If you're encountering an error like: Error: postgres: querying system variables: pq: SSL is not enabled on the server
#3478
-
If you're encountering an error like:
use 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 !startswith(trimspace(line), "#") && length(split("=", line)) > 1
}
} in your
variable "envfile" {
type = string
default = "./.env.local"
}
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 !startswith(trimspace(line), "#") && length(split("=", line)) > 1
}
}
env "local" {
name = atlas.env
src = "file://data/db/schema.sql"
url = local.envfile["DATABASE_URL"]
dev = "docker://postgres/16/dev"
migration {
dir = "file://data/db/migrations"
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
letavocado
Apr 29, 2025
Replies: 1 comment 1 reply
-
The default |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @a8m! Thank you for useful link. Yes I know, but in this doc https://atlasgo.io/faq/dotenv-files we see this example:
and this works for simple
KEY=VALUE
pairs but fails when a value contains an = itself, like in query strings or URLsso I provided solution that supports query strings