variable from a root script? Eg: I have ormconfig.js with the following content:
const path = require('path');
const baseDir = (process.env.NODE_ENV === 'development') ? 'src' : 'dist';
require('dotenv').config({
path: path.resolve(__dirname, ${baseDir}/config/config.env)
});
module.exports = {
"type": process.env.TYPEORM_CONNECTION,
"host": process.env.TYPEORM_HOST,
"port": process.env.TYPEORM_PORT,
"username": process.env.TYPEORM_USERNAME,
"password": process.env.TYPEORM_PASSWORD,
"database": process.env.TYPEORM_DATABASE,
"synchronize": process.env.TYPEORM_SYNCHRONIZE,
"logging": process.env.TYPEORM_LOGGING,
"charset": process.env.TYPEORM_CHARSET,
"bigNumberStrings": false,
"entities": process.env.TYPEORM_ENTITIES,
"migrations": process.env.TYPEORM_MIGRATIONS,
"seeds": process.env.TYPEORM_SEEDS,
"factories": process.env.TYPEORM_FACTORIES
}
but when I run through CLI all of these variables are undefined
Well why are they undefined in CLI?
Обсуждают сегодня