How to set env variable after the server has started?

I need to set some env variables after the single server has started, because the value would depend on another env variable which is different for each user. For example if I have env X which is different for each user, then I want to set env Y using this command to get a part of env X:

export Y=$(echo $X | cut -d’@’ -f 1)

How can I do that?
I tried CMD and ENTRYPOINT in Dockerfile, but it doesn’t work. I wanted to know if there is any way to do that in config.yaml?