ModelSEED Configuration - ModelSEED/Model-SEED-core GitHub Wiki

ModelSEED::Configuration

Simple interface to store configuration info

DESCRIPTION

This module provides a simple interface to get and store configuration information for the ModelSEED environment. This information is backed by a JSON file whose location is defined at object construction.

METHODS

new

This initializes a configuration object. The method accepts an optional filename inside a hashref:

my $Config = ModelSEED::Configuration->new({filename => 'path/to/file.json'});

If no filename is supplied, the enviornment variable MODELSEED_CONFIG is checked. If this variable is defined and is a valid path, it is used. Otherwise the default is to store configuration at .modelseed in the current user's $HOME directory. Note that you should probably use the instance method instead.

instance

Returns an instance of the MODELSEED_CONFIG object.

config

Returns a hashref of configuration information. From the perspective of ModelSEED::Configuration, this hashref is unstructured, and may contain keys pointing to strings, arrays or other hashrefs.

my $item = $Config->config->{key};

save

Saves the data to the JSON file. Note that this happens on object destruction, so it's not absolutely neccesary.

$Config->save();
⚠️ **GitHub.com Fallback** ⚠️