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
| Option | Type | Default | Description |
|---|---|---|---|
--secret TEXT | string | (prompted) | Your GoMask API secret. If not provided, you'll be prompted to enter it securely. |
--api-url TEXT | string | https://cli.gomask.ai/api/v1 | The GoMask API URL. Only change this for self-hosted installations. |
--output, -o PATH | path | gomask.toml | Output file path for the configuration file. |
--force, -f | flag | false | Overwrite 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
-
Add to .gitignore: Never commit
gomask.tomlto version controlecho "gomask.toml" >> .gitignore -
Use environment variables in CI/CD: Pass the secret via command line in automated pipelines
gomask init --secret $GOMASK_SECRET -
Restrict file permissions: The CLI automatically sets restrictive permissions on the config file
Configuration Priority
The CLI uses credentials in this order:
- Command-line flags (
--secret,--api-url) - Environment variables (
GOMASK_SECRET,GOMASK_API_URL) - Configuration file (
gomask.toml)
Exit Codes
| Code | Description |
|---|---|
| 0 | Configuration saved successfully |
| 1 | Error (invalid secret, write permission denied, etc.) |