-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for env variable arrays #399
Comments
This should work convict.addFormat({
name: "comma-separated-string",
validate: function (val) {
const emptyStringRegex = /^$/;
const commaSeparatedStringRegex = /^[\w\d]+(,[\w\d]+)*$/;
if (!emptyStringRegex.test(val) && !commaSeparatedStringRegex.test(val)) {
throw new Error("must be a comma separated string");
}
},
coerce: function (val) {
if (!val) return [];
return val.split(",");
},
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sry if there is already a ticket, I could not find it.
Is there any way to use arrays in a ENV variable? something like
FOO=1,2,3
?I understand that comma might be a valid char, so maybe have it opt in?
The text was updated successfully, but these errors were encountered: