Skip to content

Configuration

Serban Petrescu edited this page Apr 2, 2018 · 3 revisions

Overview

For doing the calls towards the API Manager endpoints, the library need to know:

  • The API Portal Host (e.g. apiportal-p12345345354trial.hanatrial.ondemand.com).
  • A valid API Portal user and password.

If working behind a proxy server, the HTTPS proxy also must also be configured.

There are several sources from which the configuration is pulled, with the following priority: environment variables > local .sapim file > global .sapim file

If you have installed the CLI globally, the config command can be used to create global or local .sapim files.

Using environment variables

The following environment variables are used:

  • SAPIM_HOST: API Portal host.
  • SAPIM_USERNAME: API Portal username (e.g. P-user).
  • SAPIM_PASSWORD: API Portal user password.
  • HTTPS_PROXY: the URI of the proxy server to be used for HTTPS connections.

When using the command line, these environment variables may be loaded from a .env file. This is done with the dotenv library, please refer to it to details related to usage. The .env file is searched in the current working directory by default, but this can be overloaded using the -e switch.

Using a .sapim file

A 'special' JSON configuration file can be used for configuring the library. This file can either be located locally in the current working directory or globally in the home directory. It is automatically picked up by the library. The -c command line switch allows you to specify a different location for this file.

Example .sapim file

{
    "host": "apiportal-p12345345354trial.hanatrial.ondemand.com",
    "username": "P12345345354",
    "password": "my-password-comes-here",
    "proxy": "http://proxy.example.com:3128"
}
Clone this wiki locally