The Enlyt CLI is a Command Line Interface tool built on top of Oclif (The Open CLI Foundation) framework and is used to streamline everything related to Enlyt Health Cloud Platform management & operation.
It provides the user with a set of easy-to-use commands.
The user can work with multiple tenants, multiple environments, easily switching between them back and forth, doing everything related to platform management, including (and not limited to):
- Finding out if your environment has all the required dependencies
- Configuring a tenant - reading & writing,
- Developing your apps using your local machine - mobile & web
- Building your apps locally - mobile & web
- Managing and signing assets - Android & iOS
- and a lot more ...
Note: you should have your own developer account on Apple, Google, and Firebase to be able to use all the features provided.
To install the Enlyt CLI all you have to do is execute the following command in your terminal:
npm install -g @enlythealth/enlyt
Before being able to work with your web/mobile apps, you need to perform the following steps:
- Install all required dependencies
- Set up environment variables
- Complete authentication on your tenant
To find out what dependencies are needed, run the command below:
enlyt doctor
This command will scan your settings in order to find out if you have everything required or if something is missing. In case something is missing, it will mark it with a red X.
enlyt login
In case you're logging in for the first time, you'll be asked for the Enlyt CLI Configuration URL and passphrase. This URL comes in a format similar to the Mission Control URL and that is:
https://api.{environment}.{tenantname}.app.enlythealth.com/cli
You will also be asked for a passphrase, which can also be found on Mission Control under /docs/lms/platform/cli. Once authenticated you can add your tenant's environment.
env:
namespace.
The environment you want to work with is the first thing that has to be configured before using the Enlyt CLI tool.
The Enlyt Cloud platform provides a special configuration URL for each tenant that is used to configure the Enlyt CLI with a single command. The URL is structured as follows:
https://api.{environment}.{tenantname}.app.enlythealth.com/cli
Add a new environment (tenant:environment).
$ enlyt env:add ? Enter Enlyt CLI Configuration URL: https://api.{environment}.{tenantname}.app.enlythealth.com/cli ? Enter Enlyt CLI Configuration Passphrase: {passphrase found on Mission Control}
Remove an existing environment (tenant:environment).
$ enlyt env:remove ? env: {tenantname}:prod {tenantname}:stage ❯ {tenantname}:dev (Move up and down to reveal more choices)
? env: {tenantname}:dev Environment {tenantname}:dev was removed.
Print out what the current (selected) environment (tenant:environment) is.
$ enlyt env:current Current environment is {tenantname}:{environment}.
Switch between environments.
$ enlyt env:switch ? env: {tenantname}:prod ❯ {tenantname}:stage {tenantname}:dev (Move up and down to reveal more choices) ? env: {tenantname}:stage Switched to {tenantname}:stage.
The typical scenario is when the user needs to switch between stage
and prod
environments or between different tenants.
Remove ALL environments.
$ enlyt env:clear
Done!
No namespace.
Login on currently selected environment.
$ enlyt login Login ? Enter your username: {email} ? Enter your password: ************** ? Enter MFA verification code (from SMS): {verification code} You're logged in!
Print out the currently logged-in user and what the current (selected) environment (tenant:environment) is.
$ enlyt whoami You're logged in as {email}. Current environment is {tenantname}:{environment}.
Log out from the currently selected environment.
$ enlyt logout
You've been successfully logged out.
No namespace.
Authenticate against the currently selected environment.
$ enlyt login Login ? Enter your username: {email} ? Enter your password: ************** ? Enter MFA verification code (from SMS): {verification code} You're logged in!
Print out the currently logged-in user and what the current (selected) environment (tenant:environment) is.
$ enlyt whoami You're logged in as {email}. Current environment is {tenantname}:{environment}.
Logout from the currently selected environment.
$ enlyt logout
You've been successfully logged out.
repo:
namespace.
Execute a set of commands in order to both download your apps' source code to your local machine and give you the required permissions so that you can commit and push them back to your tenant
$ enlyt repo:get-access
✔ Create new user
✔ Set permissions
✔ Generate SSH key
✔ Register SSH key
✔ Upload SSH key
✔ Configure locally
✔ Test access
✔ Done.
Clone your applications code to your local machine.
enlyt repo:clone Tenant: {tenantname}, Environment: stage, CI: N. Cloning into 'monorepo'... ... Branch 'stage' set up to track remote branch 'stage' from 'origin'. Switched to a new branch 'stage'
You can optionally specify the repository name:
enlyt repo:clone applecerts Tenant: {tenantname}, Environment: stage, CI: N. Cloning into 'applecerts'...
config:
namespace.
enlyt config:get
? Variable: EH_APP_ (Use arrow keys or type to search)
EH_APP_NAME
❯ EH_APP_IDENTIFIER_IOS
EH_APP_IDENTIFIER_ANDROID
<RETURN>
Stage Variable Value
stage EH_APP_IDENTIFIER_IOS com.enlythealth.ios
# –or–
$ enlyt config:get EH_APP_IDENTIFIER_IOS
Stage Variable Value
stage EH_APP_IDENTIFIER_IOS com.enlythealth.ios
$ enlyt config:set
? Variable: EH_APP (Use arrow keys or type to search)
❯ EH_APP_NAME
<RETURN>
? Variable: EH_APP_NAME
? Stage: stage
? Value: Enlyt Health # entered
<RETURN>
Stage Variable Old Value New Value
stage EH_APP_NAME Enlyt Enlyt Health
A command that can be used to get the contents of the .env file.
$ enlyt config:dotenv
# prints whole contents of the .env file
A command that is auto-configured on CI/CD build machines to provide the configuration of the app(s) during the build process.
This command will execute several instructions to make the tenant ready to use. That includes installing necessary packages and creating iOS apps. Also, It is possible to pass 2 optional flags:
- The '--platform' flag to enable setup only 'ios' or 'android' builds.
- The '--stages' flag to generate only the 'debug' or only the 'beta' apps.
$ enlyt bootstrap
signing:
namespace.
This namespace contains all commands needed to sign your mobile applications, both
Android and iOS.
Generate Android signing assets - keystore.jks
file. When invoked from within the core-mobile
directory, it will save the generated keystore.jks
file inside the ./android/secure
folder, which is out of version control and set up as the default location for the Android Keystore file.
$ enlyt signing:android
Generate iOS signing assets as well as creates the app(s) in Apple Developer Portal and AppStore Connect.
$ enlyt signing:ios
This command will guide the user through a series of questions, then it will connect through Apple's APIs to the Developer Portal & AppStore Connect, create everything required for the iOS apps to work and the resulting signing assets will be pushed to the Enlyt Cloud applecerts
repo for use by other developers.
Synchronize the iOS signing assets generated by the enlyt signing:ios
command from the Enlyt Health Cloud applecerts
repo to the local machine of the user that invoked the command.
$ enlyt signing:sync-ios
Synchronize the Android signing assets generated by the enlyt signing:android
command cloud storage repo to the local machine of the user that invoked the command.
$ enlyt signing:sync-android
Mobile CLI is being used for running the builds locally and in the cloud, therefore the namespace for builds is called mobile
.
mobile:
namespace.
Invoke an Android build. Run this command from within the core-mobile
directory to properly handle everything build-related.
$ enlyt mobile:android --workflow=deploy_beta_from_local
$ enlyt mobile:android --workflow=deploy_prod_from_local
Invokes an iOS build. Run this command from within the core-mobile
directory to properly handle everything build-related.
$ enlyt mobile:ios --workflow=deploy_beta_from_local
$ enlyt mobile:ios --workflow=deploy_prod_from_local
In order to create a new command, you need to create subfolder inside the commands folder. As for the structure, you can copy the structure from any of the existing commands and adapt to your needs.