I want to use Openshift to host my Grails application, and setup MySQL database on Openshift.
Openshift provide only login and password for database, but connection string is in form of environment variables OPENSHIFT_MYSQL_DB_HOST:OPENSHIFT_MYSQL_DB_PORT
and I do not see what is actual values for this vars for my database. Now I need to setup my YML config to access database, but I need somehow access from YML to environment variables OPENSHIFT_MYSQL*
.
How can I do it?
Download the latest Grails releasePATH under 'System variables' and GRAILS_HOME under 'User variables') Type "grails" at the command line, if a help message is displayed you are ready to start using Grails! If you get an error message, try to chmod +x the grails script inside the bin directory.
PY-yaml library doesn't resolve environment variables by default. You need to define an implicit resolver that will find the regex that defines an environment variable and execute a function to resolve it. You can do it through yaml.
To retrieve environment variables in Node. JS you can use process. env. VARIABLE_NAME, but don't forget that assigning a property on process.
You configure your environment by setting environment variables and creating or modifying files that relate to the environment variables. You can control whether environment variables are set at the environment level, for a specific user, or for a database session.
You reference the system environment variable with the name MYVAR
via ${MYVAR}
in your yaml file.
The values in
application.properties
are filtered through the existingEnvironment
when they are used, so you can refer back to previously defined values (for example, from System properties).
app.name=MyApp app.description=${app.name} is a Spring Boot application
See http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-placeholders-in-properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With