Custom environment variables on build process
Since migrating to Postgres 2.0, I have been trying to connect to Railway's internal network in Prisma, but there is a problem that during the build process the private address cannot be accessed, which does not allow Prisma to generate the modules according to the database.
Is there any way to define environment variables to be used exclusively in build mode?
9 Replies
N/A
both variables are going to be available at build, but it would be up to your code to connect to the public url to the do migrations/models and then connect to the private url for everything else during runtime, or just don't connect to the database at all during build and only during runtime
That's the question, does railway support any package like dotenv-cli? The only way to do this is this, since Prisma takes it directly from the .env
thats absolutely not the only way to do this, configure your code to use the public url during build and the private during runtime
So is it impossible to use Prisma on Railway using private networks? Since the compilation environment uses NODE_ENV == 'production' there is no way to do this directly within the code.
i have seen people do this before, i have not done this before, might be best to do some research on this topic
I'm not proud of it, but unfortunately desperate actions require desperate measures
never good to hardcode the database variables
Unfortunately, that's all there is for today, can you close this topic please?