resticprofile icon indicating copy to clipboard operation
resticprofile copied to clipboard

ISSUE: {{ .Now }}

Open PinoOG opened this issue 1 year ago • 5 comments

Hello, I have a problem with .Now variable, it seems like its called once both for send-before and send-after giving so a non correct time output for send-after http hook.

PinoOG avatar Nov 20 '24 20:11 PinoOG

Same applies to run commands, variables are all parsed when execution of the backup starts, reporting not update values for {{ .Now }} in this case

PinoOG avatar Nov 20 '24 22:11 PinoOG

Anything inside a double curly bracket (go template) is generated just once, before reading the configuration. So it's actually the normal behaviour.

I do understand your use case though: I could regenerate a full configuration file on each command, but I'm not entirely sure that wouldn't break any existing configuration. I need to verify that first 🤔

creativeprojects avatar Nov 21 '24 20:11 creativeprojects

Anything inside a double curly bracket (go template) is generated just once, before reading the configuration. So it's actually the normal behaviour.

I do understand your use case though: I could regenerate a full configuration file on each command, but I'm not entirely sure that wouldn't break any existing configuration. I need to verify that first 🤔

Thank you for replying, maybe this can be done using an option inside a profile? so only users putting in that profile this option will turn on the feature you said.

PinoOG avatar Nov 21 '24 20:11 PinoOG

That would be one way of doing it safely, for sure.

This templating system is still confusing though and I'm thinking we should probably populate an environment variable before each step instead.

So we would use $NOW instead of {{ .Now }}

creativeprojects avatar Nov 21 '24 20:11 creativeprojects

Yeah, it's not a bad idea. Unfortunately, I'm not an expert in Go. I wish I could have been more useful in this situation.

PinoOG avatar Nov 21 '24 20:11 PinoOG