<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Ben,<br></div><div><br></div><div><div>The only environment variables used by MapServer are listed here [2]<br></div><div>For updating other parameters I think you only have 2 choices:<br></div><div><br></div></div><div>1. Use runtime substitution <a href="https://mapserver.org/cgi/runsub.html#parameters-supported">https://mapserver.org/cgi/runsub.html#parameters-supported</a><br></div><div>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). </div><div><br></div><div>Seth</div><div><br></div><div>[1] <a href="https://mappyfile.readthedocs.io/en/latest/#modifying-values">https://mappyfile.readthedocs.io/en/latest/#modifying-values</a><br></div><div>[2] <a href="https://mapserver.org/environment_variables.html">https://mapserver.org/environment_variables.html</a><br></div><div><br></div><div id="sig62266145"><div>--<br></div><div>web:http://geographika.co.uk<br></div><div>twitter: @geographika<br></div></div><div><br></div><div><br></div><div>On Wed, Jul 29, 2020, at 4:44 PM, Ben Madin wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="ltr"><div>G'day all,<br></div><div><br></div><div>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 <a href="http://host.cloud.com">host.cloud.com</a>)<br></div><div><br></div><div>I also have a copy of the database on a development machine (ie host.docker.internal)<br></div><div><br></div><div>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.<br></div><div><br></div><div>Could I ask :<br></div><div><br></div><div>a) is there actually a simpler way to achieve the same outcome, that I have completely missed, or <br></div><div><br></div><div>b) does someone have an example of how to do it?<br></div><div><br></div><div>c) is this actually just not possible, and I should just get my sed out before every deployment commit?<br></div><div><br></div><div>cheers<br></div><div><br></div><div>Ben<br></div><div><div><br></div><div><br></div><div>-- <br></div><div dir="ltr" class="qt-gmail_signature"><div dir="ltr"><div><br></div><div><a href="https://www.ausvet.com.au/" style="background-color:transparent;color:rgb(51, 122, 183);font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:14px;line-height:1em;" target="_blank"><img src="https://www.ausvet.com.au/email/footer.png" title="Ausvet Website" alt="Ausvet Logo" width="190" border="0" style="border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:initial;border-right-style:initial;border-bottom-style:initial;border-left-style:initial;border-top-color:initial;border-right-color:initial;border-bottom-color:initial;border-left-color:initial;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;vertical-align:middle;border-top-left-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px;"></a><br></div><div><br></div><div style="font-weight:bold;font-size:13.5pt;color:grey;display:inline-block;font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;">Dr Ben Madin<br></div><div><span style="color:rgb(51, 51, 51);"><span class="font" style="font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;"><span class="size" style="font-size:14px;"><span> </span></span></span></span><br></div><div style="font-size:7.5pt;color:grey;display:inline-block;font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;">BVMS MVPHMgmt PhD MANZCVS GAICD<br></div><div><span style="color:rgb(51, 51, 51);"><span class="font" style="font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;"><span class="size" style="font-size:14px;"></span></span></span><br></div><div style="font-weight:bold;font-size:10pt;color:grey;font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;">Managing Director<br></div><div style="display:table;padding-top:10px;color:rgb(51, 51, 51);font-family:"Open Sans", Corbel, "Maven Pro", Helvetica, Arial, sans-serif;font-size:14px;"><div style="display:table-row;"><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;">Mobile:<br></div><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;"><a href="tel:+61448887220" style="background-color:transparent;color:rgb(51, 122, 183);font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:1em;line-height:1em;" target="_blank">+61 448 887 220</a><br></div></div><div style="display:table-row;"><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;">E-mail:<br></div><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;"><a href="mailto:ben@ausvet.com.au" style="background-color:transparent;color:rgb(51, 122, 183);font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:1em;line-height:1em;" target="_blank">ben@ausvet.com.au</a><br></div></div><div style="display:table-row;"><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;">Website:<br></div><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;"><a href="https://www.ausvet.com.au/" style="background-color:transparent;color:rgb(51, 122, 183);font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:1em;line-height:1em;" target="_blank">www.ausvet.com.au</a><br></div></div><div style="display:table-row;"><span style="display:table-cell;padding-right:10px;padding-bottom:0px;color:grey;"><span class="size" style="font-size:10pt;">Skype:<span> </span></span></span><span style="display:table-cell;padding-right:10px;padding-bottom:0px;color:grey;"><span class="size" style="font-size:10pt;"><a style="background-color:transparent;color:rgb(51, 122, 183);font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size:1em;line-height:1em;">benmadin</a></span></span><br></div><div style="display:table-row;"><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;">Address:<span> </span><br></div><div style="display:table-cell;padding-right:10px;font-size:10pt;padding-bottom:0px;color:grey;"><div>5 Shuffrey Street<br></div><div>Fremantle, WA 6160<br></div><div>Australia<br></div></div></div></div></div></div></div></div><div>_______________________________________________<br></div><div>mapserver-users mailing list<br></div><div><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></div></blockquote><div><br></div></body></html>