How to define a system property for the JVM with the new f-m-p

780 views
Skip to first unread message

Charles Moulliard

unread,
Oct 16, 2016, 6:47:22 AM10/16/16
to fabric8
Hi,

Is there a trick to define a system property for the JVM with the new f-m-p ?


Regards,


Charles



James Strachan

unread,
Oct 16, 2016, 7:55:07 AM10/16/16
to Charles Moulliard, fabric8
there is a reference to the environment variables you can use/set here:

e.g. use JAVA_OPTIONS to expose system properties.

There's an example of how to define environment variables in your src/main/fabric8/deployment.yml file here:



--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
James
-------
Red Hat

Twitter: @jstrachan
Email: james.s...@gmail.com
Blog: https://medium.com/@jstrachan/

open source microservices platform

Charles Moulliard

unread,
Oct 16, 2016, 9:05:59 AM10/16/16
to fabric8
Thanks James

Kubernetes refuses that I use as name this value  

spec:
  replicas: 1
  template:
    spec:
      containers:
        - env:
          - name: swarm.project.stage
            value: default

--> error generated spec.template.spec.containers[0].env[0].name: Invalid value: "swarm.project.stage": must be a C identifier (matching regex [A-Za-z_][A-Za-z0-9_]*): e.g. "my_name" or "MyName"

Is there a workaround to allow to pass "java -jar -Dswarm.project.stage=OPENSHIFT" ?

Jimmi Dyson

unread,
Oct 16, 2016, 9:16:18 AM10/16/16
to Charles Moulliard, fabric8
Environment variable names cannot contain dots (values obviously can).

Regardless, you're mixing up environment variables & system properties. As James said in his reply, the environment variable name is JAVA_OPTIONS & the value should contain the system properties you want to set, just as you would on the command line, e.g. -D....

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.

Charles Moulliard

unread,
Oct 16, 2016, 9:34:23 AM10/16/16
to fabric8, ch0...@gmail.com
Works better using 

          - name: JAVA_OPTIONS
            value: -Dswarm.project.stage=OPENSHIFT

Many thanks
Reply all
Reply to author
Forward
0 new messages