Skip to main content

Advanced Setup

The .env file

Cycle has some configurations, such as proxy information, that it reads from a .env file located at:

C:/Users/<your-user>/AppData/Roaming/Cycle/config/.env

If this file does not exist when you run Cycle, Cycle will create it for you.

The format of the .env file is a list of key=value pairs, one per line. Lines starting with # are comments.

KEY1=VALUE1
KEY2=VALUE2
# here is a comment
# and the comment continues
KEY3=VALUE3

Proxy Configuration

To make Cycle Proxy Aware, you can put the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY entries in the .env file.

# If your proxy has a port, include that as well:
# HTTP_PROXY=http://your.proxy.url:3128
HTTP_PROXY=http://your.proxy.url

# Be sure to use the correct protocol, http or https,
# according to how your proxy is setup.
# Even though this is the proxy setting for https traffic,
# in some proxy configurations,
# the correct protocol to connect to the proxy is http.
HTTPS_PROXY=http://your.proxy.url

# This is a good default for most environments.
NO_PROXY=localhost,127.0.0.1

Using a Custom .env File

In some situations it may be inconvenient to define your environment variables in the default .env file, so Cycle allows you to specify a path to a different file. For example, if you are running Cycle in a pipeline, it may be easiest to include a custom .env file in your repo and tell Cycle to load environment variables from it.

cycle-cli.exe provides the --env-file flag to supply a path to another .env file.

Cycle> cycle-cli --env-file "path/to/.env" [files to run]

The path to the .env file can be absolute or relative. If it is relative, it will be resolved against the cycle-cli executable location.

If you have a custom .env file specified and Cycle's default .env file, it will act as an override. To be precise, precedence will be handled like this:

1. Load environment variables from the custom .env
2. Load environment variables from the default .env
If a variable was already defined by the custom .env,
it will not replace the value from custom .env

Here is an example. I have a custom env file on my system with these contents:

# custom env file
HTTP_PROXY=http://myproxy.com

Cycle's default .env file has these contents:

# C:/Users/<my-user>/AppData/Roaming/Cycle/config/.env
HTTP_PROXY=http://somewhere.com
HTTPS_PROXY=http://somewhere.com
NO_PROXY=localhost,127.0.0.1

The net result will be:

HTTP_PROXY=http://myproxy.com # from custom .env
HTTPS_PROXY=http://somewhere.com # from default .env
NO_PROXY=localhost,127.0.0.1 # from default .env