Skip to content

Conversation

@whereareiam
Copy link
Contributor

@whereareiam whereareiam commented Dec 7, 2025

Motivation

Some users expressed the need for a centralized and flexible way to replace placeholders across multiple configuration files. Until now, this often required duplicating sensitive or shared values (e.g. database credentials, service endpoints, secrets) across many different configs, making maintenance error-prone and inconvenient.

To solve this, I created the Replacer module, which allows defining placeholder replacement rules in a single configuration and applying them dynamically across multiple files. This eliminates the need to manually update the same values in many places and reduces the risk of configuration inconsistencies.

#1354

Modification

  • Added a new Replacer module that:
    • Processes configurable replacement rules
    • Supports multiple targets (task, service, environment, group)
    • Allows defining file patterns for mass replacement
    • Supports multiple placeholders per rule
    • Allows different search and replace strategies (ALL, FIRST, etc.)
    • Supports dynamic values with nested placeholders (e.g. %taskName%, %nodeId%, %serviceHost%)
  • Added example configuration demonstrating:
    • Lobby MOTD replacement
    • Endpoint generation
    • Forwarding secrets for Paper & Velocity
    • Multi-target shared secrets

Result

  • Before:
    Placeholder values and secrets had to be duplicated manually across many different configuration files, making updates tedious and risky.

  • After:
    All placeholder replacements can now be managed from a single centralized configuration, automatically applied to all matching files and targets.

  • Impact:

    • Much easier configuration management
    • No need to store sensitive data in multiple configs
    • Reduced risk of mismatched or outdated values
image

@0utplay
Copy link
Member

0utplay commented Dec 15, 2025

Hi, thank you for your contribution. I think it makes more sense if you first add this module as a third-party module in CloudNet, as we already do with the CloudNet-REST module, since we currently do not have the capacity to maintain and further develop the module if necessary.

Therefore, I would be very grateful if you could publish the module yourself and add it here https://github.com/CloudNetService/CloudNet/blob/nightly/modules.json with a PR. If you need any help with this, please let me know.

@whereareiam
Copy link
Contributor Author

This PR was closed and the module was moved to a dedicated repository.
A follow-up PR was opened to add it as a third-party module.

https://github.com/whereareiam/Templify
#1824

0utplay pushed a commit that referenced this pull request Dec 20, 2025
### Motivation
As requested, the module was moved from the PR into a dedicated
repository so it can be provided as a third-party module for CloudNet.

Closes #1814 

### Modification
Added a new entry to `modules.json` to register the module and provide
its metadata.

### Result
The module is now available for download through the CloudNet module
system.
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