Repository navigation
Configuration Exporting
The export function allows you define what templates should be used, the data it should be processed against and where the resulting file should be saved/ sent.
vars:
run_env: "TEST"
trans_active: true
export:
- file_name: "charges_{{format_date 'NOW' '%Y%m%d'}}.csv"
template_name: "charges"
template_data: "CHARGE_DATA"
export_type: "AwsBucketExporter"
export_to: ""
connection_name: "AWS_1"
comment: "this is used slack"
attachment: falseNOTE: At the time of writing all files are saved to the local system. This will be changed to allow sending of files as well as saving to the local system
Exports are required to be in order, as they will be processed in the order listed.
If you do not wish to use a export, you can just leave the export array empty.
The vars section allows you to set variables that can be used in the jobs section. This allows you to set a variable once and use it in multiple jobs.
- The name that the file should be saved as. This can include the handlebars function
{{format_date 'now' '%y%m%d'}}to include the current date in the file name.- The date can be entered as follows:
{{format_date 'NOW' '%Y%m%d'}}. - Example:
charges_{{format_date 'NOW' '%Y%m%d'}}.csvwill result in a file name ofcharges_20220222.csv.
- The date can be entered as follows:
- The file name should include the file extension.
- The name of the template that should be used to process the data. This should match the name of the template in the
templatesdirectory.
-
(options)
CHARGE_DATA,REFUND_DATAorAll_DATA- The data that should be processed by the template.
-
CHARGE_DATAwill send the charge data only to the template. -
REFUND_DATAwill send the refund data only to the template. -
BOTHwill sendCHARGE_DATAorREFUND_DATAdata to the template. This should only be used when you need to include both charge and refund data in the same template. Otherwise you should use theCHARGE_DATAorREFUND_DATAoptions. -
PROCESS_DATAThis is the data for the item that have been processed against FOLIO by the system. -
ALL_DATAwill send all data returned by the API, including thePROCESS_DATA.
-
(options)
AwsBucketExporter,EmailSmtpExporter,EmailMicrosoftExporter,SfptExporterorLocalExporter- The type of export that should be used. This will determine where the file is saved.
-
AwsBucketExporterwill save the file to an S3 bucket.- The
_SECUREflag on the AWS environment variable will determine if the connection is secure or not.-
falseis used when this code is being ran as a lambda and does have direct access to the S3 bucket. -
trueis used when this code is not being ran as a lambda and does not have direct access to the S3 bucket.
-
- The
-
SfptExporterwill save the file to an Secure FTP server. -
LocalExporterwill save the file to the local system. -
EmailMicrosoftExporterwill send an email with the option to add attachments using Microsoft 365. -
EmailSmtpExporterwill send an email with the option to add attachments using SMTP protocol. -
SlackExporterwill send an message with the option to add attachments using Slack. -
BoxExporterwill save the file to a Box account. -
OneDriveExporterwill save the file to a OneDrive account.
_ All types except for LocalExporter will require the connection_name field to be set to the environment variable that contains the connection string for the export type._
- The location that the file should be saved to. This will depend on the
export_typethat is used.-
AwsBucketExporter- Not used -
SfptExporter- Not used -
LocalExporter- The local directory that the file should be saved to. This is relative to the server base directory. -
EmailMicrosoftExporterorEmailSmtpExporter- The email address that the email should be sent to. This will be used as thetofield in the email. -
SlackExporter- Not used -
BoxExporterorOneDriveExporter- The folder name that the file should be saved to. This is relative to the root of the Box or OneDrive account.
-
- This is the start of the environment variable that contains the connection string for the export type.
Example:
AWS_1_ACCESS_KEY_IDwould beAWS_1
- This is a comment that will be used when sending the file to Slack. This will be used as the message that is sent with the attachment.
- This is only used when the
export_typeis set toSLACK.
- This is only used when the
- (options)
falseor a list of attachments-
falseThis export will generate a single file (all but the email type) - When using the
emailexport type, this will be a list of attachments that should be sent with the email. It uses the same format as the export settings.
-
Templates are used to process the data that is returned by the processing system. These are handlebars templates that are saved to the templates directory.
more information can be found in the templates documentation.
export:
- file_name: "charges_{{format_date 'NOW' '%Y%m%d'}}.csv"
template_name: "charges"
template_data: "CHARGE_DATA"
export_type: "AwsBucketExporter"
export_to: ""
connection_name: "AWS_1"
attachment: falseThis will result in a file being saved as charges_20220222.csv with the data being processed by the charges template and only the charge data being processed.
export:
- file_name: "Report summary {{format_date 'NOW' '%Y%m%d'}}"
template_name: "email_body"
template_data: "CHARGE_DATA"
export_type: "EmailMicrosoftExporter"
export_to: "james@institution.com"
connection_name: "MICROSOFT_1"
attachment:
- file_name: "charges_{{format_date 'NOW' '%Y%m%d'}}.csv"
template_name: "charges"
template_data: "CHARGE_DATA"In this example a few things are happening:
-
The
file_namefield,Report summary {{format_date 'now' '%y%m%d'}}, is used to generate the email subject line. -
The
template_namefield,email_body, is used to generate the body of the email. -
The
export_tofield,james@institution.com, is the address that the email will be sent to. -
The
attachmentfield is used to generate attach the file that is generated by thechargestemplate. This will be saved ascharges_20220222.csvand attached to the email.
Note: When defining attachments the export_type, export_to and connection_name fields are not used.
export:
- file_name: "Report summary {{format_date 'NOW' '%Y%m%d'}}"
template_name: "email_body"
template_data: "CHARGE_DATA"
export_type: "SlackExporter"
export_to: ""
connection_name: "SLACK_1"
attachment:
- file_name: "charges_{{format_date 'NOW' '%Y%m%d'}}.csv"
template_name: "charges"
template_data: "CHARGE_DATA"
comment: "this is my comment for slack"In this example a few things are happening:
-
The
file_namefield,Report summary {{format_date 'now' '%y%m%d'}}, is used to generate the slack message subject line. -
The
template_namefield,email_body, is used to generate the body of the slack message. -
The
attachmentfield is used to generate attach the file that is generated by thechargestemplate. This will be saved ascharges_20220222.csvand will be sent to Slack as an attachment. -
The
commentfield is used to add a comment that will be used as the message that is sent with the attachment.
Note: When defining attachments the export_to field is not used.