Updating your Xill4 configuration
Xill4 supports two configuration formats: YAML and environment variables.
Configuration through Environment Variables
Xill4 can be configured by modifying the system's environment variables, or by adding them to the .env
file located in the application's root directory.
Setting Environment Variables
In most cases, you can also set environment variables in the terminal or command prompt;
- Linux
- Windows
- PowerShell
If you're using a Unix-like operating system, use the following command to set environment variables:
export XILL4_LICENSE_KEY=$value
If you're using Windows, you can set environment variables using the following command in Command Prompt:
set XILL4_LICENSE_KEY=$value
Alternatively, in PowerShell, you can use:
$env:XILL4_LICENSE_KEY="value"
Environment variables should always have the prefix XILL4_
, followed by the configuration group and then the property.
If you're using a Windows operating system, you can also set environment variables using the System Properties window. To access this window, navigate to Control Panel > System and Security > System > Advanced system settings > Environment Variables.
(Re)Start the Application
After setting the environment variables, (re)start the application. The configuration options should be applied automatically.
Available Environment Variables
Xill4 can be configured using the following environment variables:
-
XILL4_WORKDIRS
=> Sets the working directories in case access to the file system is needed. Directories are separated by a comma,
or semicolon;
. No allowed paths are set by default. Example:D:\tool1.exe, C:\\server\\someFolder\\tool2.exe, E:\\myLittlePony\\myLittlePony.exe
. -
XILL4_EXEC_PATHS
=> Sets the allowed paths for theexec
component. Paths are separated by a comma,
or semicolon;
. No allowed paths are set by default. Example:C:\\Program Files\\7-Zip\\7z.exe, C:\\Program Files\\ImageMagick-7.1.1-Q16-HDRI\\magick.exe
. -
XILL4_SERVER_HOST
=> Xill4 hostname. Default:localhost
. -
XILL4_SERVER_PORT
=> Xill4 host port. Default:8000
.
-
XILL4_RATE_LIMIT
=> Optional. The number of requests a unique IP address can make in an hour. Default:250
. -
XILL4_ENVIRONMENT_SECRET
=> A string that is used to encrypt and decrypt secrets. This is used to store sensitive data. The value can be any random string of your choice. Make sure to keep it private, as it plays a crucial role in protecting sensitive information.
Example Usage
.env
XILL4_WORKDIRS="D:\tool1, C:\\server\\someFolder\\tool2, E:\\myLittlePony\\folder1"
XILL4_SERVER_HOST="localhost"
XILL4_SERVER_PORT=8001
Configuration through Configuration File
Xill4 can also be configured using a YAML configuration file. This method of configuration simplifies deployment and allows for greater flexibility and control over your environment settings.
Loading Configuration files
./xill4 -c config.yml
./xill4 -c ~/some-other/folder/config.yml
Mapping Environment Variables to Config File
Some of the above mentioned environment variables can also be configured through the configuration file. Below is a table containing environment variables and the corresponding key in the configuration file.
Environment Variable | Key in Configuration File |
---|---|
XILL4_LICENSE_KEY | license.key |
XILL4_EDITOR_API_TOKEN | editor.apiToken |
XILL4_DATABASE_CONNECTION_STRING | database.connectionString |
XILL4_DATABASE_TLS | database.tls |
XILL4_DATABASE_CA | database.ca |
XILL4_PROJECT_PATH | project.path |
XILL4_SERVER_HOST | server.host |
XILL4_SERVER_PORT | server.port |
XILL4_LOGGER_PRINT_STACKTRACE | logger.printStacktrace |
XILL4_SERVER_LOCALE | server.locale |
Example Configuration
The following configuration is an example version of the configuration file. This example contains all currently supported configuration variables.
config.yml
# Set your Xill4 license key, and the host of the license server
license:
# Required, string
key: YOUR-KEY-HERE
# Required, string, default: https://api.cryptolens.io
host: https://api.cryptolens.io
# Set information regarding the logging, what levels are logged and if the list of operations before failure is logged
logger:
# Optional, string, allowed: [simple, json], default: simple
type: simple
# Optional, string
printStacktrace: false
# Optional, list, allowed: [error, warn, info, debug, http, trace, audit]
levels:
- error
- warn
- info
- debug
- http
- trace
- audit
# Set information regarding the MongoDB database connection
database:
# Required, string
connectionString: mongodb://username:password@localhost:27017/databaseName
# Boolean, default: false
tls: false
# Optional, string
ca: /path/to/ca.pem
# Optional, string
cert: /path/to/cert.pem
# Optional, string
key: /path/to/key.pem
# Set the location of the projects.json file:
project:
# String, default: ./projects
path: ./projects
# Set the OpenAI API key for editor code suggestions
editor:
# Required, string
apiToken: YOUR-API-TOKEN
# Configure where the vault is stored
environments:
# String, default: ./environments
path: ./environments
#
auth:
# Required, string
file: ./auth-config.json
# Configure to what back-end the front-end is connected to
server:
# Optional, numeric, default: 8000
port: 8000
# Optional, string, default: localhost
host: localhost
# Optional, string, default: /
baseUrl: /
# Optional, string, default: /api
apiBaseUrl: /api
# Optional, boolean, default: true
corsEnabled: true
# Optional, boolean, default: true
logRequestErrors: true
# Optional, numeric, default: 1024
maxUrlLength: 1024
# Optional, string, default: en-GB
locale: en-GB
# Optional, string, default: public
staticPath: public
# Configure the maximum number of worker threads allowed
workers:
# Optional, numeric, default: 30
maxWorkers: 30
Guidelines for Converting Between Config Files and Environment Variables:
Config File to Environment Variable:
- Convert nested YAML keys by joining them with underscores (
_
). - If a key is written in camelCase, split it at each uppercase letter and replace it with underscores (
_
), then convert all letters to uppercase. - Prefix the resulting environment variable with
XILL4_
. - Comments or descriptions are ignored in the conversion.
Example:
- Given this YAML structure:
logger:
# Optional, string, allowed: [simple, json], default: simple
type: simple
# Optional, string
printStacktrace: false
The corresponding environment variable for printStacktrace
would be:
XILL4_LOGGER_PRINT_STACK_TRACE=false
- Another example from the same YAML structure:
logger:
type: simple
- This would map to:
XILL4_LOGGER_TYPE=simple
Environment Variable to YAML Config File:
- To convert back:
- Remove the
XILL4_
prefix. - Convert uppercase letters back to lowercase.
- If the key is in snake_case (with underscores), combine the words and use camelCase if needed.
- Map the environment variable directly back into the appropriate YAML structure.
- Remove the
Example:
- Environment variable
XILL4_DATABASE_CONNECTION_STRING=mongodb://username:password@localhost:27017/databaseName
would map to:
database:
connectionString: mongodb://username:password@localhost:27017/databaseName
In this way, you can convert between environment variables and YAML config file entries seamlessly, maintaining compatibility.