Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Best Practices

sycured edited this page May 1, 2022 · 1 revision

Create a .env file in your parent project directory with the following variables:

  • JIRA_DOMAIN: my_jira.atlassian.net
  • JIRA_USER: my_email_address
  • JIRA_USER_ACCOUNT_ID: output from jira_cli user get_account_id my_email_address
  • JIRA_TOKEN: my_api_token

If you work all-time on the same project, you can also set:

  • JIRA_PROJECT_KEY: my_project_key
  • JIRA_PROJECT_ID: output from jira_cli project get_id my_project_key

Dotenv way

After, you can use a tool like dotenv or a zsh plugin like ohmyzsh plugin dotenv to load this file automatically.

For example, on my setup, it's like: /Volumes/CS/companyname/.env

Every git clone is in this folder /Volumes/CS/companyname/ so no issue about putting the .env file in git (the thing that you need to avoid).

Shell config file way

Linux and macOS

For example inside ~/.bashrc or ~/.zshrc

export JIRA_DOMAIN="my_jira.atlassian.net"
export JIRA_USER="my_email_address"
export JIRA_USER_ACCOUNT_ID="output from jira_cli user get_account_id my_email_address"
export JIRA_TOKEN="my_api_token"

# If you work all-time on the same project, you can also set:
export JIRA_PROJECT_KEY="my_project_key"
export JIRA_PROJECT_ID="output from jira_cli project get_id my_project_key"

Check

env | grep JIRA

PowerShell

For example inside your C:\Users\username\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 (working with PowerShell 7.2.3)

$env:JIRA_DOMAIN = "my_jira.atlassian.net"
$env:JIRA_USER = "my_email_address"
$env:JIRA_USER_ACCOUNT_ID = "output from jira_cli user get_account_id my_email_address"
$env:JIRA_TOKEN = "my_api_token"

# If you work all-time on the same project, you can also set:
$env:JIRA_PROJECT_KEY = "my_project_key"
$env:JIRA_PROJECT_ID = "output from jira_cli project get_id my_project_key"

Check

Get-ChildItem env: | Out-String -Stream | Select-String -Pattern 'JIRA'
Clone this wiki locally