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
- SSH to the environment where the vFunction Controller / Agent / Viper will be installed
- Switch users to the user who will run the installation or upgrade script. For example,
sudo su peter
- Add the Environment Variable. For example,
export VF_CONTROLLER_DEFAULT_JAVA_CONTROLLER_HOST="https://vfunction.myorganization.com"
- Run the vFunction Installation / Upgrade script. For example,
bash /home/peter/vfunction/opt/vfunction/controller-installation/upgrade.sh -i default-java
- 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
- RDP to the environment where the vFunction Controller / Agent / Viper will be installed
- Open PowerShell as the user who will run the installation or upgrade script. For example, Run as Administrator.
- Add the Environment Variable. For example,
$env:VF_CONTROLLER_DEFAULT_DOTNET_CONTROLLER_TAGS=“prodWebApp,prod”
- Run the vFunction Installation / Upgrade script. For example,
powershell -NoProfile -ExecutionPolicy unrestricted -Command “C:\vfunction\controller-installation\install.ps1 -instance default-dotnet”
- 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
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
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 |