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 | tar xz

    B) You can also handle this with a launch script by making a .qgtunnel.staging and a .qgtunnel.production file.

    Then in the launch script do something like this:

    if [ "$ENVIRONMENT" == "staging" ]; then
      cp .qgtunnel.staging .qgtunnel
      cp .qgtunnel.production .qgtunnel
    bin/qgtunnel $@

    Save that as something like bin/qglaunch.

    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/ 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?

    Happy tunneling!