Secret/config rotation using .yml files

I have read the techniques on for secret/config rotation, which involve doing a ‘docker service update’ command to remove a secret and simultaneously add one with a new name.

Is there a nice way to do this with a .yml file without having to edit the yml?

I tried to use an environment variable to specify the name of a config in the configs section but the .yml parser doesn’t like it.