nicolas06875
Explore posts from serversSmall question about how environnement variables works
Hey, today i deployed my API (Node, MySQL) for the first time on Railway. All works fine but i'm wondering something and I have no response.
When I work in local, I got a .env file with for exemple, the variables I need to be connected to my DB (MySQL/XAMPP) and I work with localhost... url. But on Railway i must set variables that my database host give me.
My question is : how Railway, when read these line for exemple ''const { DB_SERVEUR, DB_DATABASE, DB_USERNAME, DB_PASSWORD } = process.env;
const dataBase = new Sequelize(DB_DATABASE, DB_USERNAME, DB_PASSWORD, {
host: DB_SERVEUR,
dialect: 'mysql',
})'' know that it must read his variables and not my personnal .env ? I think this is beceause my .env is in the gitignore but how he know that he must replace the .env variables by the variables I give him ? If someone know how all of this work, and can explain me, thanks a lot ! Sorry for bad english^^
})'' know that it must read his variables and not my personnal .env ? I think this is beceause my .env is in the gitignore but how he know that he must replace the .env variables by the variables I give him ? If someone know how all of this work, and can explain me, thanks a lot ! Sorry for bad english^^
17 replies