Custom autosubmitrc path?
Hello @dbeltran, @bdepaula, @mcastril
Summary
As you already know, we are setting up a centralized installation of autosubmit at LMU.
The small issue that we have is that in our system, the workstations don't share the /etc/ folder, so we would need to replicate the configuration file in every workstation. Doable but not very convenient. A colleague at LMU suggested that a solution that would be more convenient would be to use an environment variable to specify where the configuration file is (i.e. AUTOSUBMIT_CONFIGURATION). In that way, we would be able to just set this variable in the corresponding autosubmit module file and keep the configuration file in any place, without being forced to put it in /etc/.
The implementation of this would require very few lines of code and I don't see many disadvantages:
@staticmethod
def read():
"""
Reads configuration from .autosubmitrc files, first from /etc., then for user
directory and last for current path.
"""
filename = 'autosubmitrc'
BasicConfig.__read_file_config(os.path.join('/etc', filename))
BasicConfig.__read_file_config(os.path.join(
os.path.expanduser('~'), '.' + filename))
BasicConfig.__read_file_config(os.path.join('', '.' + filename))
# Check if the environment variable is defined
if 'AUTOSUBMIT_CONFIGURATION' in os.environ:
config_file_path = os.environ['AUTOSUBMIT_CONFIGURATION']
# Call read_file_config with the value of the environment variable
BasicConfig.__read_file_config(config_file_path)
BasicConfig._update_config()
return
I tried it myself and it works.
What do you think?
Any other relevant information(if applicable)
()