Skip to content

"Not Initialized" #12

@619

Description

@619

Even with hardcoded env variables, the ok variable returns nil and the err variable returns "not initialized".
Firewall disabled, and can successfully access the postgresql database with psql from the digitalocean droplet instance.

local pg = postgres:new()
pg:set_timeout(3000)

local ok, err = pg:connect{
    host = process.env.POSTGRESQL_DATABASE_HOST_1,
    port = process.env.POSTGRESQL_DATABASE_PORT_1,
    database = process.env.POSTGRESQL_DATABASE_NAME_1,
    user = process.env.POSTGRESQL_DATABASE_USERNAME_1,
    password = process.env.POSTGRESQL_DATABASE_PASSWORD_1
}

if not ok then
    ngx.log(ngx.ERR, "Failed to connect to the database: ", err)
    return nil
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions