Configuration

The Anteater configuration is designed to be flexible and user-friendly, allowing you to customize its behavior through an XML-based configuration file (ae.xml). This file defines the environment, variables, logging, recipes, and other startup-specific settings. The hierarchical structure uses elements and attributes to specify various configurations. Below is a simplified and non-developer-friendly explanation of the structure and its components.

Configuration Overview

At the heart of the configuration is the <Environment> element. Think of this as the “container” for all your settings. Inside the <Environment>, one or more <Configuration> elements can exist. These configurations hold your actual settings.

Key Attributes of <Environment>

  • base: This allows one configuration to extend or inherit settings from another (“parent configuration”). If you want to reuse settings from another configuration, this is the way to do it.
  • name: The name of the configuration.
  • menu: Specifies the menu associated with the configuration.
  • userPreferencesEncryption: Enables encryption for saved user preferences. Use true if you want added security.
  • ip: Defines a specific IP address for the configuration (if needed).

Core Elements in Configuration

<Recipes>

Defines where your recipes (the scripts/pipelines Anteater executes) are stored.

  • Attributes:
    • path: The directory or repository containing the recipes.

Example:

<Recipes path="/path/to/recipes" />

<Var>

Used to define reusable variables.

  • Attributes:
    • name: The variable's name.
    • value: (Optional) The value assigned to the variable.
    • type: (Optional) Defines the data type (e.g., string, array, map).
    • init: (Optional) Defines how to initialize the variable (e.g., mandatory, console).

Example:

<Var name="myVar" value="some value" />
<Var name="customList" type="array">
    <item value="FirstItem" />
    <item value="SecondItem" />
</Var>

<Logger>

Handles logging settings—where and how logs are stored.

  • Attributes:

    • rootLogger: Root logger name (optional).
    • Threshold: Logging level (e.g., DEBUG, INFO, ERROR).
    • ConversionPattern: Customize the format of log messages.
    • File: File path for saving logs.
  • Nested Element: <filter>

    • Filters sensitive information or logs only necessary data.

Example:

<Logger Threshold="DEBUG" File="logs/output.log" ConversionPattern="%d %p %m%n">
    <filter class="MaskJSON" name="password" />
</Logger>

<Table>

Defines organized data using variables that can be referenced in execution.

  • Attributes:
    • name: The name of the table.
    • Nested Elements:
      • <var>: Defines each variable in the table.

Example:

<Table name="ServerConfig">
    <var name="host" value="localhost" />
    <var name="port" value="8080" />
    <var name="secure" value="true" />
</Table>

<Startup>

Specifies tasks that are executed when Anteater starts.

  • Attributes:
    • task: The name of the startup task.
    • async: Whether this task runs asynchronously (true or false).

Example:

<Startup task="InitializeDatabase" async="true" />

<Menu>

Defines the menu structure, enabling users to navigate and trigger specific tasks.

  • Attributes:
    • name: The name of the menu.
    • Nested Element: <item> defines each menu entry.

Example:

<Menu name="Main Menu">
    <item task="RunTask" />
    <item file="example.json" />
</Menu>

<Editor>

Customizes editors to handle and display certain components.

  • Attributes:
    • class: The class used for this editor.
    • name: Name of the editor.

Example:

<Editor class="com.editor.custom" name="CustomEditor" />

How to Create a Basic ae.xml File

Here’s an example of a basic configuration file for Anteater:

<?xml version="1.0" encoding="UTF-8"?>
<Environment xmlns="http://ganteater.com/xml/configuration">
    <Configuration name="Default" userPreferencesEncryption="true">
        <!-- Define Variables -->
        <Var name="apiKey" value="12345" />
        <Var name="host" value="localhost" />
        
        <!-- Logger Configuration -->
        <Logger File="logs/app.log" Threshold="INFO" />

        <!-- Recipes Configuration -->
        <Recipes path="/path/to/recipes" />

        <!-- Startup Task -->
        <Startup task="Initialize" async="true" />

        <!-- Menu -->
        <Menu name="Main Menu">
            <item task="RunTask" />
            <item file="config.json" />
        </Menu>
    </Configuration>
</Environment>

Additional Notes for Non-Technical Users

  1. Inheritance with base Attribute:

    • If you want one configuration to reuse or “inherit” properties from another, use the base attribute.
    • Example:
      <Configuration name="ExtendedConfig" base="Default">
          <Var name="extendedVar" value="extendedValue" />
      </Configuration>
      
  2. Using Variables (<Var>):

    • Variables allow you to reuse values throughout your tasks without redefining them.
  3. Logging Configuration:

    • Logs help you debug problems or monitor the application. Ensure File is specified to store logs in a file.
  4. Startup Configuration:

    • Use <Startup> to define actions Anteater runs automatically during startup.

Common Use Cases

  1. Enable Secure Logging:

    • Use filtered logging to prevent sensitive information (e.g., passwords) from being logged.

    Example:

    <Logger File="logs/secure-output.log">
       <filter class="MaskJSON" name="password" />
    </Logger>
    
  2. Execute Recipes Automatically:

    • Add directories of recipes that should be executed dynamically. Example:
    <Recipes path="/recipes/automation" />
    
  3. Organize Dynamic Data:

    • Use tables for complex or dynamic configurations. Example:
    <Table name="DatabaseConfig">
       <var name="host" value="db.local" />
       <var name="port" value="3306" />
    </Table>
    

The ae.xml configuration file is highly flexible and allows you to customize Anteater's behavior to meet your specific needs, all without requiring technical expertise. If anything is unclear, review the official documentation or reach out to support.