ME1312/SubServers-2

How to use variables in other files?

Closed this issue · 3 comments

Currently I want to replace a plugin's config variable that is loaded from a master template, like this.

\Templates
├───A
│       template.yml
│
├───B
│       template.yml
│
└───Master
    │   template.yml
    │
    └───plugins
        └───LuckPerms
                config.yml

In A and B's template I have

Template:
...
  Build:
...
    Import:
    - Master
    Replace:
    - '/plugins/LuckPerms/config.yml' # This comes from the 'Master' template
    Replacements:
      'luckperms_server': 'bedwars' # the value will be different on both A and B

In the LuckPerm's config.yml I have tried

server: $luckperms_server$
server: luckperms_server

Also I have tried to change the A and B's replacements to

    Replacements:
      'server': 'bedwars'

but it still seems like the server value is not being updated when I run
/sub update aServer A
and yes, the A template

Template:
  Enabled: true
...
  Build:
...
    Can-Update: true
    Update-Files: true
    Update-Settings: true

Also I tried to delete the generated SubServer's LuckPerm config but the same problem persists.

Variable names prefixed with SubServers:: are searched for within the specified files. See if this correction fixes the problem.

Also, for this type of use-case, you might want to consider using the dynamic variable SubServers::name instead of constant server names.

That worked! The SubServers::name wouldn't work well for me because I may have multiple A severs under different names. Maybe have a SubServers::template which would match the name of the template?

That one also exists, actually.