|
| 1 | +# AzerothCore Config Updater/Merger - Python Version |
| 2 | + |
| 3 | +A command-line tool to update your AzerothCore configuration files with new options from distribution files. |
| 4 | + |
| 5 | +> [!NOTE] |
| 6 | +> Based on and modified from [@BoiseComputer](https://github.com/BoiseComputer) (Brian Aldridge)'s [update_module_confs](https://github.com/Brian-Aldridge/update_module_confs) project to meet AzerothCore's needs |
| 7 | +
|
| 8 | +## Overview |
| 9 | + |
| 10 | +This tool compares your existing configuration files (`.conf`) with the latest distribution files (`.conf.dist`) and helps you add new configuration options that may have been introduced in updates. It ensures your configs stay up-to-date while preserving your custom settings. |
| 11 | + |
| 12 | +## Features |
| 13 | + |
| 14 | +- **Interactive Menu System** - Easy-to-use numbered menu options |
| 15 | +- **Server Config Support** - Update authserver.conf and worldserver.conf |
| 16 | +- **Module Config Support** - Update all or selected module configurations |
| 17 | +- **Automatic Backups** - If you choose a valid option and there are changes, a timestamped backup is created before any changes are made (e.g. `filename(d11_m12_y2025_14h_30m_45s).bak`) |
| 18 | +- **Selective Updates** - Choose which new config options to add (y/n prompts) |
| 19 | +- **Safe Operation** - Only creates backups and makes changes when new options are found |
| 20 | + |
| 21 | +## How to Use |
| 22 | + |
| 23 | +### Interactive Mode (Default) |
| 24 | + |
| 25 | +1. **Run the script** in your configs directory: |
| 26 | + ```bash |
| 27 | + python config_merger.py |
| 28 | + ``` |
| 29 | + Or simply **double-click** the `config_merger.py` file to run it directly. |
| 30 | + |
| 31 | +2. **Specify configs path** (or press Enter for current directory): |
| 32 | + ``` |
| 33 | + Enter the path to your configs folder (default: .) which means current folder: |
| 34 | + ``` |
| 35 | + |
| 36 | +3. **Choose from the menu**: |
| 37 | + ``` |
| 38 | + AzerothCore Config Updater/Merger (v. 1) |
| 39 | + -------------------------- |
| 40 | + 1 - Update Auth Config |
| 41 | + 2 - Update World Config |
| 42 | + 3 - Update Auth and World Configs |
| 43 | + 4 - Update All Modules Configs |
| 44 | + 5 - Update Modules (Selection) Configs |
| 45 | + 0 - Quit |
| 46 | + ``` |
| 47 | + |
| 48 | +### Command Line Interface (CLI) |
| 49 | + |
| 50 | +For automation and scripting, you can use CLI mode: |
| 51 | + |
| 52 | +```bash |
| 53 | +python config_merger.py [config_dir] [target] [options] |
| 54 | +``` |
| 55 | + |
| 56 | +**Arguments:** |
| 57 | +- `config_dir` (optional): Path to configs directory (default: current directory) |
| 58 | +- `target` (optional): What to update: |
| 59 | + - `auth` - Update authserver.conf only |
| 60 | + - `world` - Update worldserver.conf only |
| 61 | + - `both` - Update both server configs |
| 62 | + - `modules` - Update all module configs |
| 63 | + - `modules-select` - Interactive module selection |
| 64 | + |
| 65 | +**Options:** |
| 66 | +- `-y, --yes`: Skip prompts and auto-add all new config options (default: prompt for each option) |
| 67 | +- `--version`: Show version information |
| 68 | + |
| 69 | +**Examples:** |
| 70 | +```bash |
| 71 | +# Interactive mode (default) |
| 72 | +python config_merger.py |
| 73 | + |
| 74 | +# Update auth config with prompts |
| 75 | +python config_merger.py . auth |
| 76 | + |
| 77 | +# Update both configs automatically (no prompts) |
| 78 | +python config_merger.py /path/to/configs both -y |
| 79 | + |
| 80 | +# Update all modules with confirmation |
| 81 | +python config_merger.py . modules |
| 82 | +``` |
| 83 | + |
| 84 | +## Menu Options Explained |
| 85 | + |
| 86 | +- **Option 1**: Updates only `authserver.conf` from `authserver.conf.dist` |
| 87 | +- **Option 2**: Updates only `worldserver.conf` from `worldserver.conf.dist` |
| 88 | +- **Option 3**: Updates both server config files |
| 89 | +- **Option 4**: Automatically processes all module config files in the `modules/` folder |
| 90 | +- **Option 5**: Shows you a list of available modules and lets you select specific ones to update |
| 91 | +- **Option 0**: Exit the program |
| 92 | + |
| 93 | +## Interactive Process |
| 94 | + |
| 95 | +For each missing configuration option found, the tool will: |
| 96 | + |
| 97 | +1. **Show you the option** with its comments and default value |
| 98 | +2. **Ask for confirmation**: `Add [option_name] to config? (y/n):` |
| 99 | +3. **Add or skip** based on your choice |
| 100 | +4. **Create backup** (before any changes are made) only if you choose a valid option and there are changes (format: `filename(d11_m12_y2025_14h_30m_45s).bak`) |
| 101 | + |
| 102 | +## Example Session |
| 103 | + |
| 104 | +``` |
| 105 | +Processing worldserver.conf ... |
| 106 | + Backup created: worldserver.conf(d11_m12_y2025_14h_30m_45s).bak |
| 107 | +
|
| 108 | +# New feature for XP rates |
| 109 | +XP.Rate = 1 |
| 110 | + Add XP.Rate to config? (y/n): y |
| 111 | + Added XP.Rate. |
| 112 | +
|
| 113 | +# Database connection pool size |
| 114 | +Database.PoolSize = 5 |
| 115 | + Add Database.PoolSize to config? (y/n): n |
| 116 | + Skipped Database.PoolSize. |
| 117 | +``` |
| 118 | + |
| 119 | +## Requirements |
| 120 | + |
| 121 | +- Python 3.6 or higher |
| 122 | +- No additional libraries needed (uses built-in modules only) |
| 123 | + |
| 124 | +## File Structure Expected |
| 125 | + |
| 126 | +``` |
| 127 | +configs/ |
| 128 | +├── config_merger.py (this script) |
| 129 | +├── authserver.conf.dist |
| 130 | +├── authserver.conf |
| 131 | +├── worldserver.conf.dist |
| 132 | +├── worldserver.conf |
| 133 | +└── modules/ |
| 134 | + ├── mod_example.conf.dist |
| 135 | + ├── mod_example.conf |
| 136 | + └── ... |
| 137 | +``` |
| 138 | + |
| 139 | +## License |
| 140 | + |
| 141 | +This file is part of the AzerothCore Project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
| 142 | + |
| 143 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 144 | + |
| 145 | +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 146 | + |
| 147 | +**Note:** Original code portions were licensed under the MIT License by Brian Aldridge (https://github.com/BoiseComputer) |
| 148 | +Original project: https://github.com/Brian-Aldridge/update_module_confs |
0 commit comments