Chapter 1. Setting Up FHC
1.1. Installing FHC
Overview
fhc is the Red Hat Mobile Application Platform Hosted (RHMAP) command line interface (CLI) and it is Node.js based. Almost all functionality in the RHMAP Studio is exposed through the RHMAP APIs and is accessed using fhc. This allows fhc to be included in other Node.js applications thus allowing access to the Platform programmatically. Interaction with the Platform’s exposed functionality can be integrated into automated processes such as build systems and continuous integration systems.
Requirements
To use fhc, install Node.js and NPM. To install Node.js, see nodejs.org.
Once installed, two new command line applications are available, node and npm.
1.1.1. Installing FHC
In a terminal/command prompt, run:
npm install -g fh-fhc
If installing on Linux, you may need to run this command as a sudoer:
sudo npm install -g fh-fhc
This will install fhc from npm — the central registry of Node.js modules.
The -g flag tells npm to install fhc globally so that it will be available from any directory.
Once installation is complete, fhc will be available from your command line. If you use Z shell (zsh), use hash -r to reset the hash table for the command to be available.
To test FHC is installed correctly, and to show the version you have installed, use:
fhc -v
1.1.1.1. Command Completion (Linux and Mac only)
The fhc bash completion script allows Tab completion of the various fhc commands. Install fhc bash completion script:
fhc completion >> ~/.bashrc
Append the output of fhc completion to a relevant file if you use an alternative shell (not bash), for example, ~/.zshrc for zsh.
1.1.2. Usage
Set the target and login:
fhc target https://[your-studio-domain].feedhenry.com fhc login [email address] [password]
To list projects:
fhc projects list
To list all fhc commands:
fhc help
1.1.2.1. Configuration
fhc is extremely configurable. It reads its configuration options from 5 places.
-
Command line switches:
Set a config with--key val. All keys take a value, even if they are booleans (the config parser doesn’t know what the options are at the time of parsing.) If no value is provided, then the option is set to booleantrue. -
Environment Variables:
Set any config by prefixing the name in an environment variable withfhc_config_. For example,export fhc_config_key=val. -
User Configs:
The file at $HOME/.fhcrc is an ini-formatted list of configs. If present, it is parsed. If theuserconfigoption is set in the cli or env, then that will be used instead. -
Global Configs:
The file found at../etc/fhcrc(from the node executable, by default this resolves to/usr/local/etc/fhcrc) will be parsed if it is found. If theglobalconfigoption is set in the cli, env, or user config, then that file is parsed instead. -
Defaults:
fhc’s default configuration options are defined inlib/utils/config-defs.js. These must not be changed.
Execute fhc help config for more information. Use fhc help for a list of all commands, or fhc [command] --help for help on a specific command.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.