Overriding default xmigrate config
rodmatos opened this issue · 2 comments
Hello,
Currently I'm trying to override the default xmigrate
configuration inside the xmigrate.js
file, example:
The xmigrate.js
configuration file is in the root of my project.
module.exports = async () => {
return {
changelogCollectionName: 'migrations',
migrationsDir: 'migrations',
defaultTemplate: 'typescript',
outDir: './.xmigrate',
typescript: true,
logger: {
folder: './migrations-log',
up: {
success: 'up.success.log',
error: 'up.error.log',
},
down: {
success: 'down.success.log',
error: 'down.error.log',
},
},
mongodb: {
url: env.parsed.MONGO_URI,
database: "test",
options: {
useNewUrlParser: true,
},
},
}
}
But the default values are still used, tried with a local and global install.
Thanks for making a migration library that is TypeScript friendly.
I'll close this issue since I figured out the problem is on my side.
@rodmatos
Thank you for the issue created you are the first one!!
Thank you for the good words since it is a rare situation in 21 century!!
hehehe i am so happy that you like this library!
My main goal is to create tools which helps productivity for Developers so they will not loose time deciding what goes wrong.
In this case configuration is locked toxmigrate.js|ts|json
since i decided to make it ASYNC so everybody can take their configuration even from Server with Request. I was thinking about this situation if i decide to change my file in another directory but i think it is important to have such a configuration inside Root of the project so NEW developers will see everything faster and in one place. I think just like tsconfig.json
, package.json
etc.. there is a purpose to be insde Root of the project since this is the starting point of the application and the most important configuration files of the project.
- Will think about in the next release also to provide option for different location of the file.
- In the next releases maybe i will put YML support since it is a good format for configurations.
Please feel free to propose ANYTHING and it will be discussed and resolved for sure!
In the meantime maybe you would love to check this out
https://github.com/rxdi/graphqj/
It is a Graphql Development environment to help productivity for MVP's and initial projects and easily can evolve to more complex applications. It is based on @gapi/core Highly scalable graphql server.
Starting server is quite easy
npm i -g @rxdi/graphql && gj init && gj
Browser will be opened automatically to the Graphiql dev tool
It provides HotRealod of Graphql Schema without rebuilding or restarting application. Everyting is happening on Runtime.
Advanced example looks like this
$mode: advanced
$directives: ./directives.ts
$externals:
- map: 🛰
file: ./interceptors.ts
- map: 🛡️
file: ./guards.ts
- map: 🕵️
file: ./modifiers.ts
- map: ⌛
file: ./helpers/moment.js
$types:
User:
name: String => {🕵️OnlyAdmin}
email: String => {🛰LoggerInterceptor}
phone: Number => {🛡️IsLogged}
arrayOfNumbers: Number[] => {🕵️OnlyAdmin}
arrayOfStrings: String[]
$args:
UserPayload:
userId: String!
userId2: String
userId3: String
userId4: String
$resolvers:
findUser:
type: User
args:
payload: UserPayload
resolve:
name: Kristiyan Tachev
email: test@gmail.com
phone: 414141
arrayOfNumbers:
- 515151
- 412414
arrayOfStrings:
- '515151'
- '412414'
This is the WHOLE Graphql Server!
This can be translated to following Graphql Schema:
"""Query type for all get requests which will not change persistent data"""
type Query {
findUser(userId: String): User
status: StatusQueryType
}
type StatusQueryType {
status: String
}
type User {
name: String
email: String
phone: Int
arrayOfNumbers: [Int]
arrayOfStrings: [String]
}
const
Regards for finding a way resolving this issue alone!
If this method of reading configuration is unappropriated and you have problems with it please let me know!