Using Config in drizzle.config.ts with dotenvx for Environment Variables

hi, I'm using drizzle and was wondering if its possible to use Config in my drizzle.config.ts file?

root
import { defineConfig } from "drizzle-kit";

export default defineConfig({
    dialect: "postgresql",
    schema: "./src/db/schemas/index.ts",
    out: "./drizzle",
    verbose: true,
    strict: true
});

inside src
import { Config } from "effect";

export const PostgresConfig = Config.all({
    host: Config.string("POSTGRES_HOST"),
    port: Config.number("POSTGRES_PORT"),
    database: Config.string("POSTGRES_DATABASE"),
    username: Config.string("POSTGRES_USERNAME"),
    password: Config.redacted("POSTGRES_PASSWORD"),
    ssl: Config.boolean("POSTGRES_SSL")
});


I am using dotenvx to load the variables before the app starts
Was this page helpful?