Comments (3)
Hi @andyt10 ! Thanks for creating a new issue. I did think about it before and I am not sure what is the best solution. We can start with string values but I think eventually, one will want types and different validations. A bit like AWS parameters. Is it where envvars should be headed?
I also wouldn't mind having value validation based on regex. Introducing this feature would probably be simple as well as providing more options to the user.
Lately, I have been playing with CUE. You can see my spike in _cuelang.
from envvars.
Hey @flemay I think regex validation could also be a useful feature, for similar reasons I'd like to specify a list of allowed.
I also think you might be right in saying that extending the functionality of envvars might be helpdful/desired using something like CUE . For something 'next version' like that I'd perhaps picture myself packaging up a standard library of envvar/config type definitions for use in multiple projects....somehow...but that's a bit beyond what I'm considering right now.😄
For me regex/string enum validation would suit the majority of use cases that come to mind for making sure a value conforms.
I sort of pictured something like above:
- name: SERVER_ENV
.....
.....
values:
- dev
- qa
- preprod
- prod
which I think would also work similarly for regexes:
- name: SERVER_ENV
.....
.....
matchRegex: ^some[0-9]{1,}value$
where both options would be mutually exclusive (defining both would be invalid)
from envvars.
What I meant is that values
list can be written using regex :)
package main
import (
"fmt"
"log"
"regexp"
)
func main() {
r, err := regexp.Compile("(^dev$)|(^qa$)|(^preprod$)|(^prod$)")
if err != nil {
log.Fatal(err)
}
fmt.Println(r.MatchString("qa")) // true
fmt.Println(r.MatchString("preprod")) // true
fmt.Println(r.MatchString("production")) // false
}
from envvars.
Related Issues (6)
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 envvars.