1

I have created a new OpenShift account for a new application I'm developing. I have added a MongoDB cartridge for the database, and a Tomcat cartridge for the Java web application.

I now need to connect to the database from my Java web app, but I miss two authentication details:

  • $OPENSHIFT_MONGODB_DB_HOST
  • $OPENSHIFT_MONGODB_DB_PORT

As far as I know, I have to type rhc env list -a the_name_of_my_app in the console, but my application seems to have no environment variables set. What can I do?

Blakes Seven
  • 49,422
  • 14
  • 129
  • 135
Andrea
  • 675
  • 1
  • 13
  • 34
  • The website was the place to look: https://developers.openshift.com/en/managing-environment-variables.html – Blakes Seven Jul 09 '15 at 08:41
  • That page suggest to use `rhc env list -a `. When I do the same, I get an empty list. – Andrea Jul 09 '15 at 08:58
  • At any rate try conacting OpenShift support. You likely have a configuration issue with your setup. StackOverflow is not the best place to ask this question. Or, look at the "second" result from my google search: https://help.openshift.com/hc/en-us/articles/202399310-How-to-create-and-use-environment-variables-on-the-server- – Blakes Seven Jul 09 '15 at 09:03

2 Answers2

2

Apparently, the default enironment variables are visible only via ssh. In order to see them, you have to type rhc ssh <appid-as-seen-on-openshift-console> followeb by env.

Andrea
  • 675
  • 1
  • 13
  • 34
0

you can see environment variables by doing ssh to openshift. Also you can use openshift port forwarding feature to setup a connection locally to your database. Openshift blog link for port forwarding

Duggs
  • 169
  • 1
  • 12