is there a way to store `DATABASE_URL` in a file?...
# orm-help
a
is there a way to store
DATABASE_URL
in a file? (instead of
.env
)?
r
@Alan 👋 You can store it as a string in a normal `.js`/`.ts` file and use it like this.
a
great thanks! how can I override the
provider
? Thanks!
r
That’s not possible.
a
I see. thanks
If I run
npx prisma migrate deploy
it will take by default the URL in en
.env
not the one in the code.
Copy code
const prisma = new PrismaClient({
  datasources: {
    db: {
      url: config.URL_DB_LOG,
    },
  },
})
r
This can only be used in your app. When you want to run CLI commands like
migrate
you would always need to have an
.env
file. Could you explain your use case so that I can suggest something based on what you’re trying to achieve.
a
I have many databases, (hence many Prisma schema) in many environments. I need to centralize all the databases access into 1 config file. Using .env files is not a solution..
r
I don’t think this is supported at the moment. The only workaround for now is an
.env
file or injecting environment variables before Prisma’s commands. We have a request for this here and you can check the workarounds from this comment and the ones below.
a