|
| 1 | +# CodeGraph Configuration Files |
| 2 | + |
| 3 | +## Important: Configuration Directory Migration |
| 4 | + |
| 5 | +**As of the latest version, CodeGraph uses `~/.codegraph` as the primary configuration directory.** |
| 6 | + |
| 7 | +### New Location: `~/.codegraph` |
| 8 | + |
| 9 | +All user-level configuration files should now be placed in: |
| 10 | + |
| 11 | +``` |
| 12 | +~/.codegraph/ |
| 13 | +``` |
| 14 | + |
| 15 | +This provides a centralized, uniform location for all CodeGraph configuration across your system. |
| 16 | + |
| 17 | +### Why the Change? |
| 18 | + |
| 19 | +- **Centralized**: All CodeGraph configs in one place, regardless of project |
| 20 | +- **User-level**: Configurations follow you across different projects |
| 21 | +- **Standard practice**: Follows Unix/Linux convention for user configuration |
| 22 | +- **Cleaner projects**: Keeps project directories focused on code |
| 23 | + |
| 24 | +### Migration |
| 25 | + |
| 26 | +To migrate your existing configurations: |
| 27 | + |
| 28 | +```bash |
| 29 | +# Create the directory |
| 30 | +mkdir -p ~/.codegraph |
| 31 | + |
| 32 | +# Copy existing configs |
| 33 | +cp config/*.toml ~/.codegraph/ |
| 34 | + |
| 35 | +# Or symlink for development (keeps backward compatibility) |
| 36 | +ln -s $(pwd)/config ~/.codegraph |
| 37 | +``` |
| 38 | + |
| 39 | +### Backward Compatibility |
| 40 | + |
| 41 | +CodeGraph maintains backward compatibility by checking directories in this order: |
| 42 | + |
| 43 | +1. **`~/.codegraph/`** (Primary) |
| 44 | +2. **`./config/`** (This directory - fallback) |
| 45 | +3. **Current directory** (last resort) |
| 46 | + |
| 47 | +If `~/.codegraph` exists, it will be used. Otherwise, CodeGraph falls back to `./config/`. |
| 48 | + |
| 49 | +## Configuration Files in This Directory |
| 50 | + |
| 51 | +This directory contains **example configuration files** that can be copied to `~/.codegraph/`: |
| 52 | + |
| 53 | +- `default.toml` - Base configuration example |
| 54 | +- `surrealdb_example.toml` - SurrealDB configuration |
| 55 | +- `example_embedding.toml` - Embedding provider configuration |
| 56 | +- `example_performance.toml` - Performance tuning |
| 57 | +- `production.toml` - Production settings example |
| 58 | + |
| 59 | +## Quick Start |
| 60 | + |
| 61 | +### 1. Initialize User Config |
| 62 | + |
| 63 | +```bash |
| 64 | +# Create ~/.codegraph with default configs |
| 65 | +mkdir -p ~/.codegraph |
| 66 | +cp config/default.toml ~/.codegraph/ |
| 67 | +``` |
| 68 | + |
| 69 | +### 2. Customize Your Configuration |
| 70 | + |
| 71 | +```bash |
| 72 | +# Edit your user config |
| 73 | +nano ~/.codegraph/default.toml |
| 74 | + |
| 75 | +# Or create environment-specific configs |
| 76 | +cp ~/.codegraph/default.toml ~/.codegraph/development.toml |
| 77 | +cp ~/.codegraph/default.toml ~/.codegraph/production.toml |
| 78 | +``` |
| 79 | + |
| 80 | +### 3. Set Environment |
| 81 | + |
| 82 | +```bash |
| 83 | +export APP_ENV=development # Loads ~/.codegraph/development.toml |
| 84 | +# or |
| 85 | +export APP_ENV=production # Loads ~/.codegraph/production.toml |
| 86 | +``` |
| 87 | + |
| 88 | +## Environment Variables |
| 89 | + |
| 90 | +Override any config value using environment variables: |
| 91 | + |
| 92 | +```bash |
| 93 | +# Database backend |
| 94 | +export CODEGRAPH__DATABASE__BACKEND=surrealdb |
| 95 | + |
| 96 | +# SurrealDB connection |
| 97 | +export CODEGRAPH__DATABASE__SURREALDB__CONNECTION=ws://localhost:8000 |
| 98 | + |
| 99 | +# Server port |
| 100 | +export CODEGRAPH__SERVER__PORT=8080 |
| 101 | +``` |
| 102 | + |
| 103 | +## Further Documentation |
| 104 | + |
| 105 | +- **[Full Configuration Guide](../docs/CONFIGURATION_GUIDE.md)** - Complete configuration documentation |
| 106 | +- **[SurrealDB Guide](../docs/SURREALDB_GUIDE.md)** - SurrealDB-specific configuration |
| 107 | +- **[Environment Variables](../docs/CONFIGURATION_GUIDE.md#environment-variables)** - Full list of env vars |
| 108 | + |
| 109 | +## Development |
| 110 | + |
| 111 | +For development, you can continue using this `./config` directory, but we recommend migrating to `~/.codegraph` for consistency: |
| 112 | + |
| 113 | +```bash |
| 114 | +# Option 1: Copy to ~/.codegraph |
| 115 | +mkdir -p ~/.codegraph && cp config/*.toml ~/.codegraph/ |
| 116 | + |
| 117 | +# Option 2: Symlink (for active development) |
| 118 | +ln -s $(pwd)/config ~/.codegraph |
| 119 | + |
| 120 | +# Option 3: Keep using ./config (backward compatible) |
| 121 | +# CodeGraph will use ./config if ~/.codegraph doesn't exist |
| 122 | +``` |
| 123 | + |
| 124 | +## Need Help? |
| 125 | + |
| 126 | +- Check the [Configuration Guide](../docs/CONFIGURATION_GUIDE.md) |
| 127 | +- See example configs in this directory |
| 128 | +- Use `CODEGRAPH__LOGGING__LEVEL=debug` to see which config directory is being used |
0 commit comments