Hi there
I’m wanting to use environment variables (CentOS) in my readonlyrest.yml.
It seems that this has been supported in various ways in the past although I can’t get it working at the moment. I am using version 7.16.2.
I have tried the following syntaxes, found in previous support threads:
Hey there, sorry to bump, but just wondering whether environment variables are currently expected to work as per documentation or are there issues with it?
I thought maybe upgrading to 8.2.2/1.40 would solve the problem but using an environment variable such as ${LDAP_PASS} causes an exception:
uncaught exception in thread [main]
java.lang.IllegalStateException:failed to load plugin class [tech.beshu.ror.es.ReadonlyRestPlugin]
Likely root cause: org.elasticsearch.ElasticsearchException: Invalid ROR SSL configuration. Cannot resolve ENV variable ‘LDAP_PASS’.
Not a big issue, just curious because I’ve been unable to get it to work.
Edit:
Just to confirm (as that would be the obvious next question!), I have created the environment variable:
For info, in case anyone else has the same problem and comes across this post (this isn’t a ROR problem, but you might find yourself looking here)…
The issue is that if you are running elasticsearch as a service, it doesn’t have access to system environment variables.
To get around this, look in the elasticsearch system service file, something like this (I am running CentOS): /usr/lib/systemd/system/elasticsearch.service
You will see the line: EnvironmentFile=/etc/sysconfig/elasticsearch
You can set environment variables for elasticsearch inside that file, i.e. append: LDAP_PASS=myldappass
Then:
systemctl daemon-reload
Then restart elasticsearch, and the environment variable should be picked up.