Configuration File Structure
Relevant source files
The following files were used as context for generating this wiki page:
The ollacc configuration system is designed to manage environment variables and user preferences required to route Claude Code requests to the Ollama Cloud API. The primary configuration file is a flat, shell-script-compatible file that stores the Anthropic authentication token, base URL, and the user's default model selection.
This configuration is centrally managed by the ollacc launcher, which handles file creation, read/write operations, and sensitive data protection through restricted file permissions.
Sources: README.md:85-98, install.sh:65-74
File Location and Permissions
The configuration infrastructure resides within the user's home directory. The installer creates a dedicated directory and config file with strict POSIX permissions to ensure that sensitive information, such as the API key, is only accessible by the owner.
| Item | Path | Permissions | Purpose |
|---|---|---|---|
| Install Directory | ~/.ollacc/ | chmod 700 | Contains the launcher, libraries, and config. |
| Config File | ~/.ollacc/config | chmod 600 | Stores persistent environment variables. |
| Example Config | ~/.ollacc/ollacc.conf.example | chmod 644 | Reference for manual configuration. |
Sources: install.sh:10-15, install.sh:42-43, install.sh:73-74
Configuration Parameters
The configuration file uses a standard shell assignment syntax (KEY="VALUE"). This allows the application to load settings directly using the source or . command.
Key Variables
| Variable | Type | Default | Description |
|---|---|---|---|
ANTHROPIC_AUTH_TOKEN | String | "" | The Bearer token for Ollama Cloud API authentication. |
ANTHROPIC_BASE_URL | String | https://ollama.com | The endpoint URL for the OpenAI-compatible Ollama API. |
OLLAMA_CLAUDE_DEFAULT_MODEL | String | "" | The slug of the model used when no model flag is provided. |
Sources: install.sh:68-71, lib/auth.sh:11-13, README.md:164-168
Configuration Management Logic
The system provides several helper functions in lib/config.sh and lib/auth.sh to interact with the configuration file programmatically.
Data Flow for Initialization
When the application starts, it follows a specific sequence to ensure the configuration is loaded and valid.
Sources: lib/auth.sh:7-31, lib/auth.sh:78-83
Atomic Configuration Updates
The config_set function utilizes awk and a temporary file to perform atomic updates to the configuration. It preserves existing comments and only replaces the specific key being updated.
Sources: lib/config.sh:43-73
Resetting State
Users can clear specific configuration entries using CLI flags handled by lib/flags.sh. This invokes config_unset, which removes the key-value pair while leaving other settings and comments intact.
--model-clear: UnsetsOLLAMA_CLAUDE_DEFAULT_MODEL.--key-clear: UnsetsANTHROPIC_AUTH_TOKEN.
Sources: lib/flags.sh:11-30, lib/config.sh:77-88
Implementation Details
String Escaping
To prevent shell injection and ensure data integrity when sourcing the file, all values are passed through bash_escape before being written. This function escapes characters including backslashes, dollar signs, backticks, double quotes, and glob metacharacters (*, ?, [, ]).
bash_escape() {
printf '%s' "$1" | sed \
-e 's/\\/\\\\/g' \
-e 's/\$/\\$/g' \
-e 's/`/\\`/g' \
-e 's/"/\\"/g' \
-e 's/\*/\\*/g' \
-e 's/?/\\?/g' \
-e 's/\[/\\[/g' \
-e 's/\]/\\]/g'
}
Sources: lib/config.sh:17-31
SDK Environment Export
The launcher transforms the internal configuration variables into the specific environment variables required by the Anthropic SDK.
ANTHROPIC_BASE_URL: Exported as-is.ANTHROPIC_AUTH_TOKEN: Exported as-is.ANTHROPIC_API_KEY: Exported as an empty string to ensure the SDK prioritizes theAUTH_TOKEN(Bearer token).
Sources: lib/auth.sh:78-83, README.md:164-171
Conclusion
The ollacc configuration file structure provides a lightweight and secure method for persisting user credentials and preferences. By utilizing shell-native formats and strict file permissions, it balances ease of manual editing with robust automated management.