# Subscription Configuration Files

This documentation has been lifted from the subscription processing
module. We will be replacing it with information about a utility that
will be provided so the configuation file does not have to be directly
edited.

The configuration file consists of Perl variables:

%cfg_url

This is the pattern for forming a URL. It is based on strftime-style
date/time formats, with extensions for other elements like data type,
version and filename. The currently supported patterns are:

-   %Y: four-digit year

-   %m: two-digit month (01-12)

-   %d: two-digit day of month (01-31)

-   %j: three-digit day of year (01-366)

-   %=T: data type (dataset name)

-   %=V: three-digit data version (001-999)

-   %=F: filename

For example, a Data Pool URL for a MOD02SSH granule would look like
this:

ftp://g0dps01u.ecs.nasa.gov/MOGT/%=T.%=V/%Y.%m.%d/%=F

## %cfg_subscriptions

This is a complex hash, keyed on subscription ID. The value is an
anonymous hash with \"notify\", \"label\", \"destination\" and
dataset/version keys. The dataset (datatype) must be an exact match, but
the version can be a regular expression. These dataype/version keys also
reference anonymous hashes with validator and filter keys. The validator
array is a sequence of programs to be run which, if successful, will
send the subscription out. The programs are provided with the list of
files (metadata last) and can do coverage checks or the like. The
program \'true\' should be run if the send is unconditional. A single
subscription key can select any number of dataset/version keys and all
will be reported in the same notification message. Conversely separate
subscriptions for the same destination can be used to segregate notices
for different datasets.

The filter key references an anonymous hash whose keys are are patterns
which, if they match the URL, will have their corresponding values
passed to the post office to filter the outgoing file. These can be used
to, for example, extract ODL from metadata files. The value is the
program to be run to do the filtering; it must print the name of the
results file to stdout. The filtering is current done as a part of the
push processing. The current design ignores it for ftp pull. The data
notificiations do not give useful URL information for filtered files.

The notify key references a hash with an address key providing a URL
(sendto for mail, but can also be ftp for anonymous push) and a format
string (=S4PA\|LEGACY\|PDR to specify original S4PA format, ECS DN
notification format, or PDR format repectively). The label key provides
a user-defined string to be passed for identifying the subscription. The
optional destination key gives a URL to which the corresponding files
will be pushed by ftp or sftp or mailto (and whose hostname part will be
used to name the work order).

For example:

%cfg_subscriptions = (

\"FTP-Pull-S4PA\" =\> {

notify =\> {

address =\> \'mailto: hegde@daac.gsfc.nasa.gov \', format =\> \'S4PA\'
},

label =\> \"FTP-Pull-S4PA\", \"MOD021KM..\*\" =\> {

validator =\> \[ \'true\' \] }

},

\"FTP-Pull-ECS\" =\> {

notify =\> {

address =\> \'mailto: hegde@daac.gsfc.nasa.gov \', format =\> \'LEGACY\'
},

label =\> \"FTP-Pull-ECS\", \"MOD021KM..\*\" =\> {

validator =\> \[ \'true\' \] }

},

\"S4PA-Pull-PDR\" =\> {

notify =\> {

address =\> \'mailto: hegde@daac.gsfc.nasa.gov \', format =\> \'PDR\' },

label =\> \"S4PA-Pull-PDR\", \"MOD021KM..\*\" =\> {

validator =\> \[ \'true\' \] }

},

\"FTP-Push\" =\> {

notify =\> {

address =\> \'mailto: hegde@daac.gsfc.nasa.gov \', format =\> \'LEGACY\'
},

destination =\> \"ftp:discette.gsfc.nasa.gov/private/s4pa/push\", label
=\> \"FTP-Push\", \"MOD021KM..\*\" =\> {

validator =\> \[ \'true\' \] }

},

\"SFTP\" =\> {

notify =\> {

address =\> \'ftp:discette.gsfc.nasa.gov/private/s4pa/push\', format =\>
\'LEGACY\' },

destination =\> \'sftp:reason.gsfc.nasa.gov/var/tmp/hegde\', label =\>
\"SFTP\", \"MOD021KM..\*\" =\> {

validator =\> \[ \'true\' \], filter =\> {

\'xml\' =\> \'s4pa_extract_ODL.pl -o /var/tmp/\' }

}

}

);