Setup
Yeedu CLI(Command Line Interface) is a standard CLI to run interactively with Yeedu's RESTful-API.
Need to run below command from the project directory to setup the yeedu CLI on the environment.
- PyPI
pip install yeedu-cli==4.7.0
- Windows
- Linux
pip install --editable .
Generate Executable file for yeedu CLI
- Need to install
pyinstaller
using below mentioned command
pip install pyinstaller
- From project directory execute below mention command
pyinstaller --onefile yeedu.py
Traverse to \dist
directory and get the executable file yeedu.exe
- The yeedu.exe commands can be formed as shown below:
yeedu.exe [-h]
yeedu.exe <command> [-h]
yeedu.exe <command> <subcommand> [-h]
- Example of yeedu CLI command using executable file
yeedu.exe resource list-providers
- WSL
sudo apt install python3-pip
pip3 install --editable .
- Bash
sudo python3 setup.py develop
Environment Variable Setup
Create a .env
file in the project directory and provide below environment variables.
# Below mentioned values are the default values of Environment Variables
YEEDU_RESTAPI_URL="http://localhost:8080"
YEEDU_CLI_LOG_DIR=~/.yeedu/cli/logs/
YEEDU_CLI_MAX_LOG_FILES=5 # Number 0f log files as an integer
YEEDU_CLI_MAX_LOG_FILE_SIZE=30 # Log file size in MB as an integer
YEEDU_USERNAME=USER
YEEDU_PASSWORD=PASS
YEEDU_RESTAPI_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFiY2RlZiIsImlkIjoiMSIsImlhdCI6MTY2NzgwOTYwMX0.HwhdTHBttnR0NFtmUDjcxTLMSLfyNuBs7t7GO9zOf08
YEEDU_RESTAPI_TOKEN_FILE_PATH=/home/user/yeedu_cli.config
Alternative of .env
file
- Windows
- Linux
SET YEEDU_RESTAPI_URL="http://localhost:8080"
SET YEEDU_CLI_LOG_DIR=~/.yeedu/cli/logs/
SET YEEDU_CLI_MAX_LOG_FILES=5
SET YEEDU_CLI_MAX_LOG_FILE_SIZE=30
SET YEEDU_USERNAME=USER
SET YEEDU_PASSWORD=PASS
SET YEEDU_RESTAPI_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFiY2RlZiIsImlkIjoiMSIsImlhdCI6MTY2NzgwOTYwMX0.HwhdTHBttnR0NFtmUDjcxTLMSLfyNuBs7t7GO9zOf08
SET YEEDU_RESTAPI_TOKEN_FILE_PATH=/home/user/yeedu_cli.config
export YEEDU_RESTAPI_URL="http://localhost:8080"
export YEEDU_CLI_LOG_DIR=~/.yeedu/cli/logs/
export YEEDU_CLI_MAX_LOG_FILES=5
export YEEDU_CLI_MAX_LOG_FILE_SIZE=30
export YEEDU_USERNAME=USER
export YEEDU_PASSWORD=PASS
export YEEDU_RESTAPI_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFiY2RlZiIsImlkIjoiMSIsImlhdCI6MTY2NzgwOTYwMX0.HwhdTHBttnR0NFtmUDjcxTLMSLfyNuBs7t7GO9zOf08
export YEEDU_RESTAPI_TOKEN_FILE_PATH=/home/user/yeedu_cli.config
Authentication Setup
- Below mentions ways of storing the credentials which will be used [Environment Variables will be given a priority] to generate the token.
Storing the credentials as Environment Variables
YEEDU_USERNAME=USER
YEEDU_PASSWORD=PASS
Storing the credentials inside a yeedu_credentials.config
file
- The yeedu_credentials.config file needs to be created inside the directory
home/user/.yeedu/
which consists of JSON as shown below:
{
"YEEDU_USERNAME": "USER",
"YEEDU_PASSWORD": "PASS"
}
Storing the Yeedu Session Token inside a file
- If the user is already having the Yeedu Session Token. Then user can save the token at the any location and provide the file path in enviroment variable
YEEDU_RESTAPI_TOKEN_FILE_PATH
- For example
YEEDU_RESTAPI_TOKEN_FILE_PATH="/home/user/Documents/YeeduToken/{FileName}"
- For example
- Format to store the token is as shown below:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxLCJpYXQiOjE2ODg3MjA0MjIsImV4cCI6MTY4ODg5MzIyMn0.EfxuXKPBISQB4ep-sPQbo6R7tg2irlnAC_krqnuXJ5Q"
}