Configuring the odo CLI

You can find the global settings for odo in the preference.yaml file which is located by default in your $HOME/.odo directory.

You can set a different location for the preference.yaml file by exporting the GLOBALODOCONFIG variable.

Viewing the current configuration

You can view the current odo CLI configuration by using the following command:

  1. $ odo preference view

Example output

  1. PARAMETER CURRENT_VALUE
  2. UpdateNotification
  3. NamePrefix
  4. Timeout
  5. BuildTimeout
  6. PushTimeout
  7. Ephemeral
  8. ConsentTelemetry true

Setting a value

You can set a value for a preference key by using the following command:

  1. $ odo preference set <key> <value>

Preference keys are case-insensitive.

Example command

  1. $ odo preference set updatenotification false

Example output

  1. Global preference was successfully updated

Setting a value

You can unset a value for a preference key by using the following command:

  1. $ odo preference unset <key>

You can use the -f flag to skip the confirmation.

Example command

  1. $ odo preference unset updatenotification
  2. ? Do you want to unset updatenotification in the preference (y/N) y

Example output

  1. Global preference was successfully updated

Preference key table

The following table shows the available options for setting preference keys for the odo CLI:

Preference keyDescriptionDefault value

UpdateNotification

Control whether a notification to update odo is shown.

True

NamePrefix

Set a default name prefix for an odo resource. For example, component or storage.

Current directory name

Timeout

Timeout for the Kubernetes server connection check.

1 second

BuildTimeout

Timeout for waiting for a build of the git component to complete.

300 seconds

PushTimeout

Timeout for waiting for a component to start.

240 seconds

Ephemeral

Controls whether odo should create an emptyDir volume to store source code.

True

ConsentTelemetry

Controls whether odo can collect telemetry for the user’s odo usage.

False

Ignoring files or patterns

You can configure a list of files or patterns to ignore by modifying the .odoignore file in the root directory of your application. This applies to both odo push and odo watch.

If the .odoignore file does not exist, the .gitignore file is used instead for ignoring specific files and folders.

To ignore .git files, any files with the .js extension, and the folder tests, add the following to either the .odoignore or the .gitignore file:

  1. .git
  2. *.js
  3. tests/

The .odoignore file allows any glob expressions.