Setting a connection host from ENV

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting a connection host from ENV

Ben Madin-2
G'day all,

I am migrating a number of systems onto containers, and have hit a blocker with a solution with over 100 mapfiles, all of which refer to a database that is tucked away in a vpc in the cloud, with an a record for the connection host (ie host.cloud.com)

I also have a copy of the database on a development machine (ie host.docker.internal)

For most everything else in the docker world (our web interfaces etc), I can set use env variables in the container system, but I'm really struggling with how best to do this in this case. I can do a url variable for the connection parameter, and specify the database in every call... seems pretty clumsy, and not good practice really. but my attempts to reference environment variables in the mapfile have been very unsuccessful.

Could I ask :

a) is there actually a simpler way to achieve the same outcome, that I have completely missed, or 

b) does someone have an example of how to do it?

c) is this actually just not possible, and I should just get my sed out before every deployment commit?

cheers

Ben


--

Ausvet Logo

Dr Ben Madin
 
BVMS MVPHMgmt PhD MANZCVS GAICD
Managing Director
Mobile:
<a href="tel:+61448887220" style="background-color:transparent;color:rgb(51,122,183);font-family:&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif;font-size:1em;line-height:1em" target="_blank">+61 448 887 220
Skype: benmadin
Address: 
5 Shuffrey Street
Fremantle, WA 6160
Australia

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Setting a connection host from ENV

Seth G-2
Hi Ben,

The only environment variables used by MapServer are listed here [2]
For updating other parameters I think you only have 2 choices:

2. Create deployment specific Mapfiles. There are a few choices for this - sed as you mentioned, but also MapScript. For a similar situation I use mappyfile [1] (a Python Mapfile parser). 

Seth


--
web:http://geographika.co.uk
twitter: @geographika


On Wed, Jul 29, 2020, at 4:44 PM, Ben Madin wrote:
G'day all,

I am migrating a number of systems onto containers, and have hit a blocker with a solution with over 100 mapfiles, all of which refer to a database that is tucked away in a vpc in the cloud, with an a record for the connection host (ie host.cloud.com)

I also have a copy of the database on a development machine (ie host.docker.internal)

For most everything else in the docker world (our web interfaces etc), I can set use env variables in the container system, but I'm really struggling with how best to do this in this case. I can do a url variable for the connection parameter, and specify the database in every call... seems pretty clumsy, and not good practice really. but my attempts to reference environment variables in the mapfile have been very unsuccessful.

Could I ask :

a) is there actually a simpler way to achieve the same outcome, that I have completely missed, or 

b) does someone have an example of how to do it?

c) is this actually just not possible, and I should just get my sed out before every deployment commit?

cheers

Ben


--

Ausvet Logo

Dr Ben Madin
 
BVMS MVPHMgmt PhD MANZCVS GAICD

Managing Director
Mobile:
<a href="tel:+61448887220" style="background-color:transparent;color:rgb(51, 122, 183);font-family:&quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif;font-size:1em;line-height:1em;" target="_blank">+61 448 887 220
Skype: benmadin
Address: 
5 Shuffrey Street
Fremantle, WA 6160
Australia
_______________________________________________
mapserver-users mailing list


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users