Skip to content

Add libconfig import support to remaining conf files#3409

Open
MrKeiKun wants to merge 2 commits into
HerculesWS:masterfrom
MrKeiKun:fix/62-libconfig-import-support
Open

Add libconfig import support to remaining conf files#3409
MrKeiKun wants to merge 2 commits into
HerculesWS:masterfrom
MrKeiKun:fix/62-libconfig-import-support

Conversation

@MrKeiKun
Copy link
Copy Markdown
Contributor

Pull Request Prelude

Changes Proposed

Adds the import: override mechanism to conf files that were missing it, consistent with the existing pattern used in map-server.conf, char-server.conf, etc.

  • conf/atcommand.conf — added import lookup in atcommand_config_read()
  • conf/groups.conf — refactored read_config() in pc_groups.c to use a static config pool so all configs stay alive until inheritance resolution and atcommand->load_groups() complete
  • conf/channels.conf — split read_channels_config() into a _from_file() helper with recursive import support
  • conf/battlegrounds.conf — same wrapper/helper split pattern
  • conf/clans.conf — import recurses with reload=false to avoid clearing the DB on the secondary file
  • conf/network.conf and conf/api/api_network.conf — added import lookup in socket_net_config_read() (already accepted a filename)
  • conf/plugins.conf — replaced the old fopen replace-hack with proper merge support; HPMHooking-first ordering preserved via an is_primary flag

Each modified conf file gets an import: line pointing to conf/import/<name>.conf, and a corresponding skeleton is added to conf/import-tmpl/.

Issues addressed: #62

@MrKeiKun MrKeiKun force-pushed the fix/62-libconfig-import-support branch from 62cf4ca to 3505112 Compare April 20, 2026 14:10
@MrKeiKun MrKeiKun force-pushed the fix/62-libconfig-import-support branch from d26954e to d4106c9 Compare April 28, 2026 10:42
Comment thread src/common/socket.c
#endif // BUILDBOT

{
const char *import = NULL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need to open a new scope, we're using C11 already.

Comment thread src/map/battleground.c

static void bg_config_read(void)
{
bg_config_read_from_file("conf/battlegrounds.conf");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that creating a function just to do this call? instead edit the original function to take a file name and edit the call with default file name.

Comment thread src/map/battleground.c
}

{
const char *import = NULL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need to open a new scope, we're using C11 already.

Comment thread src/map/channel.c

static void read_channels_config(void)
{
read_channels_config_from_file("conf/channels.conf");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, no need for new function.

Comment thread src/map/channel.c
ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename);
}

{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need to open a new scope, we're using C11 already.

Comment thread src/map/clan.c
clan->config_read_additional_settings(settings, config_filename);
clan->read_db(settings, config_filename, reload);

{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need to open a new scope, we're using C11 already.

Comment thread src/map/pc_groups.c
* Pool of config objects kept alive until all group processing is done.
* group_settings->commands/permissions/root point into these configs.
*/
#define PC_GROUPS_MAX_CONFIGS 2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there a limit? a vector can be used here.

@hemagx hemagx added this to the Release v2026.05 milestone May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants