Configuration
floimg can be configured through files, environment variables, or CLI commands. Configuration is optional - most commands work without any setup.
Configuration Priority
Section titled “Configuration Priority”Settings are loaded in this order (later sources override earlier ones):
- Global config -
~/.floimg/config.json - Local config -
.floimgrc.jsonorfloimg.config.tsin current directory - Environment variables - Shell environment or
.envfile - CLI arguments - Passed directly to commands
Quick Setup
Section titled “Quick Setup”The easiest way to configure FloImg is with the interactive setup:
floimg config initThis prompts you for:
- S3 bucket and region (for cloud storage)
- OpenAI API key (for AI-powered generators)
And saves to ~/.floimg/config.json.
Config File Formats
Section titled “Config File Formats”JSON (.floimgrc.json)
Section titled “JSON (.floimgrc.json)”{ "save": { "default": "s3", "s3": { "bucket": "my-images", "region": "us-east-1", "endpoint": "https://s3.amazonaws.com" } }, "ai": { "default": "openai", "openai": { "apiKey": "sk-..." } }}TypeScript (floimg.config.ts)
Section titled “TypeScript (floimg.config.ts)”import type { FloimgConfig } from '@teamflojo/floimg';
const config: FloimgConfig = { save: { default: 's3', s3: { bucket: process.env.S3_BUCKET || 'my-images', region: 'us-east-1', }, }, ai: { default: 'openai', openai: { apiKey: process.env.OPENAI_API_KEY, }, },};
export default config;TypeScript configs are great for:
- Environment variable interpolation
- Type checking
- Conditional configuration
Environment Variables
Section titled “Environment Variables”S3 / AWS
Section titled “S3 / AWS”| Variable | Description |
|---|---|
AWS_ACCESS_KEY_ID | AWS access key |
AWS_SECRET_ACCESS_KEY | AWS secret key |
AWS_REGION | AWS region (e.g., us-east-1) |
S3_BUCKET | Default S3 bucket name |
S3_ENDPOINT | Custom S3-compatible endpoint |
Tigris Storage
Section titled “Tigris Storage”floimg supports Tigris (S3-compatible storage on Fly.io):
| Variable | Description |
|---|---|
TIGRIS_ACCESS_KEY_ID | Tigris access key |
TIGRIS_SECRET_ACCESS_KEY | Tigris secret key |
TIGRIS_BUCKET_NAME | Tigris bucket name |
TIGRIS_REGION | Tigris region (usually auto) |
When Tigris variables are set, floimg automatically uses the Tigris endpoint.
AI Providers
Section titled “AI Providers”| Variable | Description |
|---|---|
OPENAI_API_KEY | OpenAI API key for DALL-E and other AI features |
CLI Config Commands
Section titled “CLI Config Commands”floimg config init
Section titled “floimg config init”Interactive setup wizard that prompts for common settings:
floimg config initOutput:
floimg configuration setup=========================
S3 Configuration (optional - press Enter to skip): S3 Bucket name: my-images S3 Region [us-east-1]: us-west-2
OpenAI Configuration (optional - press Enter to skip): OpenAI API Key: sk-...
✓ Configuration saved to: ~/.floimg/config.jsonfloimg config set
Section titled “floimg config set”Set individual configuration values:
# S3 settingsfloimg config set s3.bucket my-imagesfloimg config set s3.region us-west-2
# OpenAI settingsfloimg config set openai.apiKey sk-...floimg config get
Section titled “floimg config get”View current configuration:
# Show all configfloimg config get
# Show specific keyfloimg config get s3.bucketfloimg config path
Section titled “floimg config path”Show where configuration files are searched:
floimg config pathOutput:
Configuration file locations (in order of priority): 1. ./floimg.config.ts (current directory) 2. ./.floimgrc.json (current directory) 3. ~/.floimg/config.json (global) 4. Environment variables
Global config location: /Users/you/.floimg/config.jsonChecking Your Configuration
Section titled “Checking Your Configuration”Use the doctor command to verify your setup:
floimg doctorOutput:
floimg doctor==============
Version: 0.3.1Node version: v22.0.0
Configuration file search: ✗ Local TypeScript config: not found ✗ Local JSON config: not found ✓ Global config: ~/.floimg/config.json
Current configuration: S3 Storage: - Bucket: my-images - Region: us-west-2 - Endpoint: default (AWS) - Credentials: configured OpenAI: - API Key: set
Environment variables: AWS/S3: - AWS_REGION: us-west-2 - S3_BUCKET: my-images - AWS_ACCESS_KEY_ID: set AI: - OPENAI_API_KEY: set
Installed plugins: ✓ @teamflojo/floimg-qr ✓ @teamflojo/floimg-quickchart
✨ Ready to use!npx Usage
Section titled “npx Usage”When running via npx, floimg uses:
- Environment variables from your shell
- Any
.envfile in the current directory (if you use a tool like dotenv) - Global config at
~/.floimg/config.json(runfloimg config initonce to set up)
Most shorthand commands (qr, resize, convert, chart) work without any configuration since they don’t require cloud storage or AI.
Example: Setting Up S3 Storage
Section titled “Example: Setting Up S3 Storage”# Option 1: Environment variablesexport AWS_ACCESS_KEY_ID="AKIA..."export AWS_SECRET_ACCESS_KEY="..."export AWS_REGION="us-east-1"export S3_BUCKET="my-images"
# Option 2: Config filefloimg config set s3.bucket my-imagesfloimg config set s3.region us-east-1
# Now you can save to S3floimg generate --generator shapes --params '{"type":"gradient"}' \ --out s3://my-images/gradient.pngExample: Setting Up OpenAI
Section titled “Example: Setting Up OpenAI”# Option 1: Environment variableexport OPENAI_API_KEY="sk-..."
# Option 2: Config filefloimg config set openai.apiKey sk-...
# Now you can use AI generatorsfloimg generate --generator openai \ --params '{"prompt":"A sunset over mountains"}' \ --out ai-sunset.pngSecurity Notes
Section titled “Security Notes”- Never commit API keys or credentials to version control
- Use environment variables in CI/CD pipelines
- The global config file (
~/.floimg/config.json) is stored in your home directory floimg config setmasks sensitive values (keys, secrets) in output
See Also
Section titled “See Also”- CLI Overview - All CLI commands
- SDK Save - Programmatic storage configuration
- MCP Integration - Using floimg with AI agents