How do I set up environment-specific .qgtunnel files?
There are three options we’ve seen to make this work. Each works perfectly fine and either can be adjusted to fit your needs.
A) We’ve added the ability to store the configuration file in an environment variable “QGTUNNEL_CONFIG”.
Note: The QGTUNNEL_CONFIG option will only work if you have the April 2021 (or later) version of qgtunnel installed.
If you aren’t sure if you have the most recent version of qgtunnel, you can grab it using:
curl https://s3.amazonaws.com/quotaguard/qgtunnel-latest.tar.gz | tar xz
B) You can also handle this with a launch script by making a
.qgtunnel.staging and a
Then in the launch script do something like this:
#!/bin/bash if [ "$ENVIRONMENT" == "staging" ]; then cp .qgtunnel.staging .qgtunnel else cp .qgtunnel.production .qgtunnel fi bin/qgtunnel $@
Save that as something like
Then change your startup code to call
bin/qglaunch with all your program arguments instead of bin/qgtunnel.
C) We’ve seen some customers save the full
.qgtunnel file into an environment variable and in the launch script they create the .qgtunnel file from the environment variable.
Note: If you are using transparent mode, be sure that vendor/nss_wrapper/libnss_wrapper.so is also added to your repository.
You can use this variable to help in situations where you have multiple environments and want to make sure they’re starting up with the right configuration file.
Pretty easy, huh?