<div dir="ltr"><div>One other thing. One challenge with environment variables is knowing what's consistently available within a runtime environment - CGI is different from FastCGI and there are differences across web servers. That's one of the reasons pre-processing is kind of attractive IMHO. I suppose the v.8 config file could play a role but I'm unsure what that would be beyond a place to set values consistently.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 12, 2022 at 8:04 PM Steve Lime <<a href="mailto:sdlime@gmail.com">sdlime@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Paul: The idea of referencing environment variables has come up before. Another example would be to leverage settings injected into cloud deployments as environment variables (I think there's an old ticket that was recently re-opened on the topic). I'm not sure what the best way to handle this would be. One possibility would be using a mechanism similar to runtime subs where you'd reference the variables within the mapfile using ${variable} or whatever. Another idea would be to use a pre-processor of some sort to "compile" a mapfile from the environment. The latter would result in better performance since you'd generate the resulting file once and could also do things like inlining included snippets. This functionality would be helpful for the cloud deployments, simplifying deployments in multiple (dev, test, prod) environments and for keeping secrets out of repos altogether.<div><br></div><div>We're putzing around with the pre-processing idea a bit but haven't gotten anything fully baked. Others?</div><div><br></div><div>-Steve</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 12, 2022 at 4:56 AM Paul via MapServer-users <<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px"><div dir="ltr">hi list, this has probably been discussed before, but maybe there are updates (on v8?)</div><div dir="ltr"><br></div><div dir="ltr">we would like to extract the <span><code>ows_onlineresource from the environment, instead of having an administrator to configure it on the mapfile</code></span></div><div dir="ltr"><br></div><div dir="ltr">currently we implement a hack where the webserver layer sends an additional query parameter `ows_url` to mapserver which contains the current url</div><div dir="ltr"><br></div><div dir="ltr">in the mapfile this is implemented as </div><div dir="ltr"><br></div><div dir="ltr">```</div><div dir="ltr"><div><pre lang="plaintext"><span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC1">WEB</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC2"> VALIDATION</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC3"> "ows_url" "(\b(https?|ftp|file)://)?[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]"</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC4"> END</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC5"> </span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC6"> METADATA</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC7"> "ows_onlineresource" "%ows_url%"</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC8"> END</span>
<span lang="plaintext" id="gmail-m_8906421840414282941gmail-m_-1578593230117342386ydpa2a2adfLC9">END</span></pre></div></div><div dir="ltr">```</div><div dir="ltr"><br></div><div dir="ltr">I wonder if others run into similar challenges, or if there are much more simple best practices for this case.</div><div dir="ltr"><br></div><div dir="ltr">I can imagine allowing a environment parameter 'proxy-url' like geoserver would make sense, but it should allow some kind of template, eg:</div><div dir="ltr"><br></div><div dir="ltr">```</div><div dir="ltr">PROXY-URL <a href="https://example.com/cgi-bin/mapserv?map=%7Bmap%7D.map" target="_blank">https://example.com/cgi-bin/mapserv?map={map}.map</a></div><div dir="ltr">```</div><div dir="ltr"><br></div><div dir="ltr">which in our case would be </div><div dir="ltr"><br></div><div dir="ltr"><div><div dir="ltr" style="color:rgb(0,0,0);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">```</div><div dir="ltr" style="color:rgb(0,0,0);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">PROXY-URL <a href="https://example.com/cgi-bin/%7Bmap%7D" target="_blank">https://example.com/cgi-bin/{map}</a></div><div dir="ltr" style="color:rgb(0,0,0);font-family:"Helvetica Neue",Helvetica,Arial,sans-serif">```</div></div><br></div><div dir="ltr">Thank you, Paul.</div></div></div>_______________________________________________<br>
MapServer-users mailing list<br>
<a href="mailto:MapServer-users@lists.osgeo.org" target="_blank">MapServer-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
</blockquote></div>
</blockquote></div></div>