# Add custom gateway files to backup

**URL:** <https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266>\
**Category:** Module Development\
**Created:** [June 1, 2022, 3:47pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266 "2022-06-01T15:47:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [June 1, 2022, 3:47pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/1 "2022-06-01T15:47:56Z")

</div>

Often we use config files at a gateway level (in the data folder, not project) for customizations on a per-gateway basis.

Normally we use git to move things around, so it handles these pretty well, but I have a use case where I can’t use git and need to move them with a gateway backup.

Is there either a way to implement this through one of the following?

1. Something naming or config related that ignition will just pick up on. I.e. if we name it “configs” specifically, the gateway backup utility will catch it.
2. Some config parameter I could give the ignition.conf file to tell it to include an extra folder inside data (ideal)
3. Something module wise I could implement to implement a backup hook that allows me to add my own resources to the backup, that are gateway specific.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 1, 2022, 4:22pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/2 "2022-06-01T16:22:38Z")

</div>

The easiest thing would probably be to use the filetype `.conf`; Ignition will grab anything with that extension. I would have thought storing in `data/modules/$yourModuleId` would be safe, but you’d probably want to do testing.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [June 1, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/3 "2022-06-01T16:30:14Z")

</div>

> [@paul-griffith](#):
>
> The easiest thing would probably be to use the filetype `.conf`; Ignition will grab anything with that extension.

Darn, the only annoying thing about that is most of our configs are `json` out of the ease of use in python/perspective. Any I would miss the syntax highlighting in vs code by switching to `.conf`

> [@paul-griffith](#):
>
> I would have thought storing in `data/modules/$yourModuleId` would be safe, but you’d probably want to do testing.

Looks like anything in this folder makes its way through. I just create a random folder at `data/modules/not-a-module` with a `json` file and it worked. Not in love with the idea of nesting it in the modules folder, but this will at least work in the short term.

If I go the route of building an extra module so they can live at the data level, do you know of any hooks into the backup utility? Ideally I would like to use `data/configs` since thats what we have standardized on at this point.

EDIT: A bit cheeky, but if you name the top level folder `configs.conf` then it looks like whatever wildcard search Ignition is using catches that, however it doesn't catch a folder named `.conf`? Maybe something to do with how it tries to avoid `.git` folders causing issues with project resources.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 1, 2022, 4:35pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/4 "2022-06-01T16:35:40Z")

</div>

> [@kgamble](#):
>
> EDIT: A bit cheeky, but if you name the top level folder `configs.conf` then it looks like whatever wildcard search Ignition is using catches that, however it doesn’t catch a folder named `.conf`? Maybe something to do with how it tries to avoid `.git` folders causing issues with project resources.

Yeah, that's exactly what's happening. The current behavior looks like this:

```java
private final Set<String> includes = Set.of("opc", "gateway.xml", "redundancy.xml", "gateway-network",
    "log4j.properties", "opcua-clients-unknown.keystore", "certificates", "modules", "projects",
    "logback.xml", "opcua");

public boolean accept(File file) {
    String name = file.getName();
    return !name.startsWith(".") && !name.endsWith(".bak") && !name.endsWith(".gwbk")
        && (includes.contains(name.toLowerCase()) || name.endsWith(".conf"))
        || isPerspectiveThemeBackupFolder(file) || isOpcUaUuidFile(file);
}

```

Not the clearest thing in the world...

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 1, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/5 "2022-06-01T16:37:02Z")

</div>

And there’s no hooks for third party modules to change this behavior. You’d probably be best off using the `data/modules/` route with a custom module.

---

<div class="post-metadata">

**Author:** ![kgamble](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kgamble/32/8019_2.png) [@kgamble](https://forum.inductiveautomation.com/u/kgamble)\
**Post date:** [June 1, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/add-custom-gateway-files-to-backup/60266/6 "2022-06-01T16:42:00Z")

</div>

> [@paul-griffith](#):
>
> Not the clearest thing in the world…

Who doesn't love a hyper-custom chain of `and/or` logic to determine if something counts as valid! lol

I appreciate the insight. Sounds like the desired pattern would be adding something into a module, the `.conf` route feels a little hacky, I appreciate the help.
