How to move importer secrets to a secrets file
Since version 2.17, the recordm-importer reads secrets (tokens, passwords) from a dedicated recordm-importer-secrets.properties file, kept next to recordm-importer.properties. Moving the secrets there keeps the main properties file free of sensitive values, so it can stay in cleartext in the repository while only the small secrets file is encrypted.
Pre-requirements
This page assumes you know how a custom importer is configured and have SOPS set up to create encrypted files in the server repository.
In the importer's directory, create the secrets file as an encrypted file, as described in How to add, update and remove encrypted files:
shsops <importer-dir>/recordm-importer-secrets.properties.encMove the secret lines from
recordm-importer.propertiesinto it, keeping the same key names — typicallyrecordm.token,datasource.passwordorhttp4.authPassword. See the secrets file template for the full list per importer type. When the same key exists in both files, the value in the secrets file wins, so the migration is just moving lines from one file to the other.If any groovy script of the importer (
body.groovy,uri.groovy, ...) read one of the moved values from thepropertiesheader, change it to usesecret(...)instead — secrets are no longer part of that header:groovydef pass = secret('datasource.password')See Accessing secrets in scripts for the available calls.
Commit both changes together and deploy. On startup the importer logs the number and the names of the loaded secrets (values are never logged) — confirm the keys you moved are listed:
Loaded 2 secret(s) from .../recordm-importer-secrets.properties: [datasource.password, recordm.token]
See also
- Importer properties template — the secrets file template and the
secret()scripting API. - How to add, update and remove encrypted files — encrypting the secrets file and converting the now secret-free main file back to cleartext.
- How to generate an intemporal token — obtaining the
recordm.tokenvalue.
