Tim Holloway wrote:That's not really enough information.
I have built environment-insensitive applications since long before containers and cloud computing. JEE web applications, for example, get their configuration information (per the standard) from 2 deployment descriptors. There's a server-independent deployment descriptor, which is the webapp's [tt]/WEB-INF/web.xml[/i] data. And the server-dependent deployment descriptor that, as its name indicates, is specific to the particular instance and type of deployment. Tomcat, for example, uses a Context XML element. By leverating this, I can use the exact same WAR on my desktop, on Beta test machines, and in Production. Which means that if Production fails, I don't have to worry about there being something different in the compiled classes that would prevent trying to re-0ccreate the fault in a test/diagnostic environment.
Configuration for non-java apps under Linux typically goes in an '/etc/" file or directory. When containerizing such a setup, one generally aliases it to an external mountpoint. That's what my Bacula containers do, for example. Since the containers are not integral to the OS, the actual target here is /opt/bacula/conf", mappring to the container's internal /etc/bacula/ directory.
It's really pretty easy to do this kind of stuff and inject it as part of container deployment, regardless of which sort of container orchestration system you're using, be it Kubernetes, Docker Compose, or in my case, Ansible.
Henry Wong wrote:
John Landon wrote:
This is awesome thanks (the closest I've seen) but it does match 5.0.......
It matches "5.0" because that is how the regex is coded. I took your original post, as disallowing trailing zeros, but allowing one digit after the decimal point. So, "5.00" is not allowed, but "5.0" is allowed.
The fix to this, is actually very simple. Just get rid of the alternation after the decimal, that allows it.
And .... Remember when I said that you should never use a regex that you don't understand? Well, this fix is ridiculously easy to do, and this is a chance for you to understand the regex. So, give it a try at fixing it yourself.
Henry
Knute Snortum wrote:
John Landon wrote:Also it doesnt match number 5
Henry Wong's regex? It does for me, running the little program.
John Landon wrote:
Carey Brown wrote:When working with complex regular expressions I find it useful to create a 20 line regex tester program that takes as parameters an array of "good" test cases that are expected to match, and an array of "bad" test cases that are expected to fail. If any test doesn't result in the expected outcome it should report the failed string.
It matches the 0
http://www.freeformatter.com/java-regex-tester.html#ad-output
Carey Brown wrote:When working with complex regular expressions I find it useful to create a 20 line regex tester program that takes as parameters an array of "good" test cases that are expected to match, and an array of "bad" test cases that are expected to fail. If any test doesn't result in the expected outcome it should report the failed string.
Henry Wong wrote:
First, I guess I can take a shot at it (and without actually compiling or testing it, so take with a grain of salt)...
Second, assuming that this even works, I highly recommend that you don't use it without actually understanding it !!
Henry
Carey Brown wrote:
If you look closely you'll see that it is one long regex String put together with String (+) concatenation.How about leading zeros? Pleas how do I apply them all at once?
I just broke it out so that you can see the separate rules separated by an OR (|).
Carey Brown wrote:
Haven't tested it but I think this should work.
Ron McLeod wrote:
John Landon wrote:No because I need to do it in validation annotation
You could make your annotation take multiple expressions.
fred rosenberger wrote:Why do you want a single regex to do all these things? Wouldn't it be easier to write several, smaller ones that each do a picece of the checks you need?
Paul Clapham wrote:Oh right, you asked for examples of how to use that.