How to define secret in config.php

Recently I have realized I don’t have ‘secret’ defined in config.php. This makes mail app unusable.
I dont recall setting secret or deleting it. Maybe it was never there. My oldest backup is one year old and there is no ‘secret’. Instance running since owncloud 7.
Just adding ‘secret’ to my config.php makes whole nextcloud unusable. I cannot login facing Internal Server Error.

Is there any proper way to define ‘secret’ in running installation?