vue-cli-plugin-env-validator
v1.0.2
Published
Validate Environment Variables with type checking like Vue Props
Downloads
206
Readme
Vue CLI Env Validator Plugin
A Vue CLI Plugin to validate Environment Variables with type checking like Vue Props.
Install
vue add env-validator
Usage
// 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
}
}
}
}
}
Usage with a prefix
// 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
}
}
}
}
}
License
Under the MIT license. See LICENSE file for more details.