How to use Environment Variables for vFunction Installation parameters


Overview

The vFunction Controller Installation uses a Global.yaml and Installation.yaml to configure installation settings. In some circumstances, like Containerized Deployments or environments where Secrets cannot be hard-coded into files, it may be more convenient to use environmental variables during the installation process.

See the examples below for how to use environmental variables during the installation workflow.


Linux Images - Implementation Workflow

  1. SSH to the environment where the vFunction Controller / Agent / Viper will be installed
  2. Switch users to the user who will run the installation or upgrade script. For example, sudo su peter
  3. Add the Environment Variable. For example, export VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_HOST="https://vfunction.myorganization.com"
  4. Run the vFunction Installation / Upgrade script. For example, bash /home/peter/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
  5. Note that the Environment Variable will be added to the appropriate configuration file(s) for the vFunction instance and process, such as /home/peter/vfunction/etc/sysconfig/vfunction/controller/instances/default-java/conf.json

Windows Images - Environment Variable Workflow

  1. RDP to the environment where the vFunction Controller / Agent / Viper will be installed
  2. Open PowerShell as the user who will run the installation or upgrade script. For example, Run as Administrator.
  3. Add the Environment Variable. For example, $env:VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_TAGS=“prodWebApp,prod”
  4. Run the vFunction Installation / Upgrade script. For example, powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\install.ps1 -instance default-dotnet”
  5. Note that the Environment Variable will be added to the appropriate configuration file(s) for the vFunction instance and process, such as C:\vfunction\config\instances\default-dotnet\conf.json

Syntax for Environment Variables

The name of an override Environment Variable for a value in the installation.yaml will be in the form of VF_CONTROLLER_$instanceName_$keyName_$subKeyName=$value. The underscore character will be used to replace hyphens and periods.

The name of an override Environment variable for a value in the global.yaml will be in the form of VF_GLOBAL_$keyName_$subKeyName=$value.


Installation.yaml Examples
Environment Variable
Installation.yaml Field
VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_NAME="prod-notification" vFunction Instance = default-java, installation.yaml's controller.name: prod-notification
VF_CONTROLLER_PRODAPP1_CONTROLLER_CLIENT_ID="1111-11-11-1111" vFunction Instance = prodApp1, installation.yaml's controller.client_id: 1111-11-11-1111
VF_CONTROLLER_DEFAULT_DOTNET_VIPER_ASSEMBLIES="C:\vfunction\assemblies\" vFunction Instance = default-dotnet, installation.yaml's viper.assemblies: C:\vfunction\assemblies\

Global.yaml Examples
Environment Variable
Global.yaml Field
VF_GLOBAL_GENERAL_CUSTOM_LOG_FOLDER="C:\logCollector\" global.yaml's general.custom_log_folder: C:\logCollector\
VF_GLOBAL_VIPER_USE_MACHINE_JAVA_FOR_VIPER=true global.yaml's viper.use_machine_java_for_viper: true