Skip to content

Configuration

Configure the pfy CLI for authentication and customized behavior.

Configuration Hierarchy

The CLI uses a three-level priority system for configuration:

  1. Command-line flags (highest priority)
  2. Environment variables
  3. Config file at ~/.pfy/config.yaml (lowest priority)

Authentication

Using the Login Command

The recommended way to configure authentication:

bash
pfy login \
  --server https://manager.example.com \
  --token your-personal-access-token

This creates ~/.pfy/config.yaml with your credentials:

yaml
manager_url: https://manager.example.com
token: your-personal-access-token

Environment Variables

Set credentials via environment:

bash
export PFY_MANAGER_URL="https://manager.example.com"
export PFY_MANAGER_TOKEN="your-token"

Add to your shell profile for persistence:

bash
# ~/.bashrc or ~/.zshrc
export PFY_MANAGER_URL="https://manager.example.com"
export PFY_MANAGER_TOKEN="your-token"

Command-line Flags

Override configuration per command:

bash
pfy --manager https://staging.example.com \
    --token staging-token \
    project list

Configuration File

Location

  • Default: ~/.pfy/config.yaml
  • Created automatically by pfy login

Format

yaml
manager_url: https://manager.example.com
token: your-personal-access-token

Manual Creation

Create the configuration directory and file:

bash
mkdir -p ~/.pfy
cat > ~/.pfy/config.yaml <<EOF
manager_url: https://manager.example.com
token: your-personal-access-token
EOF

Set secure permissions:

bash
chmod 600 ~/.pfy/config.yaml

Global Flags

Available on all commands:

Connection Flags

bash
--manager string
  Manager URL in format http(s)://host:port
  Env: PFY_MANAGER_URL
  Config: manager_url

--token string
  Personal Access Token for authentication
  Env: PFY_MANAGER_TOKEN
  Config: token

--insecure-skip-tls-verify
  Skip TLS certificate verification (not recommended for production)

Output Flags

bash
--verbose, -v
  Enable verbose output with detailed information

--quiet, -q
  Minimize output (useful for scripting)

--ci
  Indicate CI/CD environment execution

Multiple Environments

Manage multiple Manager instances using different config files:

Development

bash
# Use dev config
pfy --manager https://dev.example.com \
    --token dev-token \
    project list

Staging

bash
# Use staging config
pfy --manager https://staging.example.com \
    --token staging-token \
    project list

Production

bash
# Use production config from default config file
pfy project list

Environment-specific Aliases

Create shell aliases for different environments:

bash
# ~/.bashrc or ~/.zshrc
alias pfy-dev='pfy --manager https://dev.example.com --token dev-token'
alias pfy-staging='pfy --manager https://staging.example.com --token staging-token'
alias pfy-prod='pfy --manager https://prod.example.com --token prod-token'

Usage:

bash
pfy-dev project list
pfy-staging application create --tenant-id <id> --slug app --name "App"
pfy-prod project list

TLS Configuration

Skip TLS Verification

For development with self-signed certificates:

bash
pfy --insecure-skip-tls-verify project list

Security Warning

Never use --insecure-skip-tls-verify in production environments. This disables certificate validation and makes you vulnerable to man-in-the-middle attacks.

Custom CA Certificates

If using custom CA certificates, add them to your system trust store:

Linux

bash
sudo cp your-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

macOS

bash
sudo security add-trusted-cert -d -r trustRoot \
  -k /Library/Keychains/System.keychain your-ca.crt

CI/CD Integration

GitHub Actions

yaml
name: Deploy with pfy
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Install pfy CLI
        run: |
          curl -LO https://github.com/ProductifyFW/cli/releases/latest/download/pfy-linux-amd64
          chmod +x pfy-linux-amd64
          sudo mv pfy-linux-amd64 /usr/local/bin/pfy

      - name: Deploy
        env:
          PFY_MANAGER_URL: ${{ secrets.PFY_MANAGER_URL }}
          PFY_MANAGER_TOKEN: ${{ secrets.PFY_TOKEN }}
        run: |
          pfy --ci project list

GitLab CI

yaml
deploy:
  image: golang:1.25
  variables:
    PFY_MANAGER_URL: $MANAGER_URL
    PFY_MANAGER_TOKEN: $MANAGER_TOKEN
  script:
    - curl -LO https://github.com/ProductifyFW/cli/releases/latest/download/pfy-linux-amd64
    - chmod +x pfy-linux-amd64
    - mv pfy-linux-amd64 /usr/local/bin/pfy
    - pfy --ci project list

Configuration Best Practices

  1. Never commit tokens - Use .gitignore for config files
  2. Use environment variables for CI/CD
  3. Rotate tokens regularly - Create new PATs periodically
  4. Use separate tokens for different environments
  5. Set restrictive permissions - chmod 600 ~/.pfy/config.yaml
  6. Use verbose mode for debugging - --verbose flag
  7. Use quiet mode for scripts - --quiet flag for parseable output

Troubleshooting

Authentication Errors

bash
# Verify configuration
cat ~/.pfy/config.yaml

# Test connection with verbose output
pfy --verbose project list

# Re-authenticate
pfy login --server https://manager.example.com --token new-token

Connection Issues

bash
# Check Manager URL accessibility
curl https://manager.example.com/query

# Test with verbose mode
pfy --verbose --manager https://manager.example.com project list

Token Issues

If your token isn't working:

  1. Verify the token hasn't expired in the Manager UI
  2. Check token permissions and scopes
  3. Create a new token and re-authenticate
  4. Ensure token is correctly copied (no extra spaces)