[MXS-1464] Add environment variables processing for maxscale.cnf Created: 2017-10-06  Updated: 2020-08-25  Resolved: 2017-10-12

Status: Closed
Project: MariaDB MaxScale
Component/s: Core, StartupScripts
Affects Version/s: None
Fix Version/s: 2.2.1

Type: Task Priority: Major
Reporter: Valerii Kravchuk Assignee: Johan Wikman
Resolution: Fixed Votes: 0
Labels: None


 Description   

For Docker users (and maybe for other scenarios) it would be great if MaxScale substituted values for shell environment variables in the configuration file before reading the values. So that in case like this:

[node1]
type=server
address=$MARIADB_IP1
port=6603
protocol=MySQLBackend
 
[node2]
type=server
address=$MARIADB_IP2
port=6603
protocol=MySQLBackend

we get easy and clean way to pass IP addresses of back end servers,

Workarounds (like running script to pre-process template configuration files or passing configuration file from the host environment exist. but the problem is quite common to get some documented solution out of the box.

It may be a modification to startup script, or adding more predefined variables like MAXSCALE_OPTIONS, or just change in the code for options parsing.



 Comments   
Comment by Johan Wikman [ 2017-10-12 ]

If the value of a configuration entry in the configuration file starts with a $, then everything that follows is interpreted as the name of an environment variable and the value of the configuration entry is replaced with the value of that environment variable.

It is a fatal error to refer to an environment variable that does not exist.

Generated at Thu Feb 08 04:06:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.