A Vue CLI Plugin to validate Environment Variables with type checking like Vue Props.
vue add env-validator
// vue.config.js
module.exports = {
pluginOptions: {
envValidator: {
schema: {
VUE_APP_FIREBASE_API_KEY: {
type: String,
required: true
},
VUE_APP_ENABLE_FIREBASE_AUTH: {
type: Boolean,
required: true
},
VUE_APP_FIREBASE_AUTH_PWD_MIN_LENGTH: {
type: Number,
required: true
}
}
}
}
}
// vue.config.js
module.exports = {
pluginOptions: {
envValidator: {
prefix: 'VUE_APP_',
schema: {
FIREBASE_API_KEY: {
type: String,
required: true
},
ENABLE_FIREBASE_AUTH: {
type: String,
required: true
},
FIREBASE_AUTH_PWD_MIN_LENGTH: {
type: Number,
required: true
}
}
}
}
}
Under the MIT license. See LICENSE file for more details.