How can I avoid writing passwords in readonlyrest.yml ?
Where should I run the export commands for the environment variables?
export is a bash shell command.
You need to set the environment variable. The method of doing so, depends on the OS and shell you use.
I use bash on suse sles 12
There are many resources on the Internet where you can read about how to do it. Eg. this one.