Comments (5)
There was quite some related discussion here: #77
tldr is:
You can configure your configuration file to point an environment to a specific environment variable, which is supposed to contain a database URL:
{
"production": {
"use_env_variable": "DB_HOST"
}
}
In that case the CLI will load the env var DB_HOST
and throw it into the url module to parse it. Credentials can be passed as well.
from cli.
Would env vars be an options?
from cli.
Sure.
from cli.
Great. Thanks.
from cli.
hope I'm not bothering coming by here; as for now this is not obvious
You then need to have two files to handle the configuration ( default sequelize.json, then some config.js than can parse environments variables) ? Or maybe 3 ( a something.js that declares which environments variables can be parsed via use_env_variable
— according to #77) ?
As he is asking initially, wouldn't that be possible to handle the conf directly in index.js database/models definition file, using process.env vars, without relying on multiple external files ? This approach would sound a bit more straightforward and easy to understand
from cli.
Related Issues (20)
- Error on running db: migrate with Node 18.17.9 HOT 1
- Support for Improved Migration Directory Structure and Configuration HOT 2
- Model.associate adding new columns
- Proposal: Controller Generation in Sequelize
- Migrations should happen in a transaction HOT 30
- Tests are stuck HOT 5
- postgres: db:create should not fail if the database does exist
- BulkInsert "relation does not exist" in migration script
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function HOT 1
- Sequelize CLI Fails to Authenticate with Postgres DB Containing a ':' in Password HOT 3
- CLI is not taking default env like node latest versions have (20.8.0)
- SequelizeMeta structure incompatible with SingleStore/memsql HOT 2
- Problem running migrations with yarn
- When on typescript project, sequelize-cli still generates javascript files. HOT 3
- Running migrations, on Azure database HOT 1
- Seeders state in database with using url option
- Migration undo command didn't work correctly. HOT 1
- where condition in literal HOT 1
- nested dependency es5-ext has a security vulnerability (low) and needs update HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.