Documentation

gomask init

Initialize CLI configuration with authentication credentials

gomask init

Initialize CLI configuration with authentication credentials.

Synopsis

gomask init [OPTIONS]

Description

The init command sets up your GoMask CLI credentials by creating a gomask.toml configuration file. This file stores your API secret securely and is required for all other CLI operations.

You can obtain your API secret from the GoMask web application at Settings → API Keys.

Options

OptionTypeDefaultDescription
--secret TEXTstring(prompted)Your GoMask API secret. If not provided, you'll be prompted to enter it securely.
--api-url TEXTstringhttps://cli.gomask.ai/api/v1The GoMask API URL. Only change this for self-hosted installations.
--output, -o PATHpathgomask.tomlOutput file path for the configuration file.
--force, -fflagfalseOverwrite existing configuration file without prompting.

Examples

Interactive Setup (Recommended)

gomask init

You'll be prompted to enter your API secret securely (input is hidden):

Enter your GoMask API secret: ********
Configuration saved to gomask.toml

Non-Interactive Setup

gomask init --secret "your-api-secret-here"

Custom Configuration Location

gomask init --output config/gomask.toml

Force Overwrite Existing Config

gomask init --force

Self-Hosted Installation

gomask init --api-url "https://gomask.yourcompany.com/api/v1"

Configuration File

The generated gomask.toml file contains:

# GoMask CLI Configuration
[gomask]
# Your GoMask API secret
secret = "your-api-secret"

# GoMask API URL
api_url = "https://cli.gomask.ai/api/v1"

# Optional: Set to true to enable debug logging
# debug = false

Security Best Practices

  1. Add to .gitignore: Never commit gomask.toml to version control

    echo "gomask.toml" >> .gitignore
    
  2. Use environment variables in CI/CD: Pass the secret via command line in automated pipelines

    gomask init --secret $GOMASK_SECRET
    
  3. Restrict file permissions: The CLI automatically sets restrictive permissions on the config file

Configuration Priority

The CLI uses credentials in this order:

  1. Command-line flags (--secret, --api-url)
  2. Environment variables (GOMASK_SECRET, GOMASK_API_URL)
  3. Configuration file (gomask.toml)

Exit Codes

CodeDescription
0Configuration saved successfully
1Error (invalid secret, write permission denied, etc.)

See Also