63 lines
2 KiB
Markdown
63 lines
2 KiB
Markdown
# Configuration Guide
|
|
|
|
GemReader uses a TOML-based configuration file to customize the application behavior. The configuration file is named `config.toml` and should be placed in the same directory where you run the application.
|
|
|
|
## Default Configuration File
|
|
|
|
The default `config.toml` file looks like this:
|
|
|
|
```toml
|
|
title = "GemReader"
|
|
```
|
|
|
|
## Available Configuration Options
|
|
|
|
### title
|
|
|
|
- **Type**: String
|
|
- **Default**: "GemReader"
|
|
- **Description**: Sets the title displayed at the top of the application interface
|
|
|
|
### default_file
|
|
|
|
- **Type**: String
|
|
- **Default**: "" (empty)
|
|
- **Description**: Sets the default markdown file to open when no file is provided as a command-line argument
|
|
|
|
## Configuration Loading
|
|
|
|
The application attempts to load the configuration file when it starts. If the file is not found or contains errors, the application will continue to run with default settings.
|
|
|
|
The configuration is loaded using the [Viper](https://github.com/spf13/viper) library, which supports:
|
|
|
|
1. Loading from `config.toml` in the current directory
|
|
2. Environment variable overrides (with `GEMREADER_` prefix)
|
|
3. Default fallback values
|
|
|
|
## Example Advanced Configuration
|
|
|
|
While the current version only supports the title configuration, future versions may support additional options:
|
|
|
|
```toml
|
|
title = "My Markdown Viewer"
|
|
|
|
# These options are planned for future releases:
|
|
# theme = "dark" # Color theme (dark/light)
|
|
# toc_enabled = true # Whether to generate table of contents
|
|
# line_numbers = false # Show line numbers
|
|
# wrap_text = true # Wrap long lines
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Configuration File Not Found
|
|
|
|
If the application starts but the custom title isn't displayed, ensure that:
|
|
|
|
1. The `config.toml` file exists in the current working directory
|
|
2. The file has the correct format and valid TOML syntax
|
|
3. The application has read permissions for the file
|
|
|
|
### Invalid Configuration
|
|
|
|
If the configuration file contains invalid TOML syntax, the application will log an error and use default values instead.
|