sanjairocky.github.io

Installing confar

You can install confar easily using the provided installation script by running it with the sh command.

Note: Make sure you have a working internet connection before proceeding.

Installation Steps

  1. Open your terminal.

  2. Download and run the installation script using sh:

    sh -c "$(curl -fsSL https://sanjairocky.github.io/confar/install.sh)"
    

    or

    Alternatively, you can use wget to download and execute the script:

    sh -c "$(wget https://sanjairocky.github.io/confar/install.sh -O -)"
    

    or

    Alternatively, you can use pip to install:

    pip install confar
    

Verification

To verify that confar is installed successfully, you can run the following command:

  confar --version

How To Run

Parse & aggregate configuration

confar parse <file>

Parse & run the configuration

confar run <file>

Web - UI to run the configuration (comming soon)

confar web

Flow Configuration Documentation

This documentation explains the structure of a YAML file used for configuring flows. The YAML file includes various flow configurations under the flows key.

Flows

The flows section defines different flow configurations, each identified by a unique name. Each flow consists of a list of steps that define the sequence of actions to be executed.

Example:

flows:
  echo:
    - name: shell exe
      shell: pwd
    # ...
  default:
    - name: calling flow
      call: echo
    # ...
  # ...

Default Flow

The default flow is a special flow that defines the steps to execute when no specific flow is specified. It is used as a fallback.

Environment (env)

The env section defines environment variables that can be used within steps of the flows.

Example

env:
  - name: shell with env
    shell: echo {$.envd}
  - name: env adding
    env:
      envd: ${PWD}-{$.obj[test]}
  - name: shell with env
    shell: echo {$.envd}

Conditionals (if)

The if section defines conditional statements that determine whether to execute certain steps based on conditions.

Example:

if:
  - name: conditional flow if
    if: $.ar and not len($.ar)
    then:
      - name: passed hello
        shell: echo {$.obj[test]}

Over All Example

# Scenario 1: Basic Shell Commands
flows:
  echo:
    - name: shell exe
      shell: pwd
    - name: shell with env
      shell: echo {$.hello}

# Scenario 2: Conditional Flows
if:
  - name: conditional flow if
    if: $.ar and not len($.ar)
    then:
      - name: passed hello
        shell: echo {$.obj[test]}

  - name: conditional flow if .. else
    if: $.hello
    then:
      - name: passed if
        shell: echo "passed if"
    else:
      - name: passed if .. else
        shell: echo "passed if .. else"

  - name: conditional flow else .. if .. else
    if: $.hello
    then:
      - name: passed hello
        shell: echo "passed hello"
    else:
      - if: $.hello
        then:
          - name: passed if .. else
            shell: echo "passed if .. else"
        else:
          - name: passed hello
            shell: echo "passed hello"

# Scenario 3: Sub-Flows (including Default Flow)
flows:
  default:
    - name: calling flow
      call: echo
    - name: another step
      shell: echo "Another step in the default flow"

# Scenario 4: Environment Variables
env:
  - name: shell with env
    shell: echo {$.envd}
  - name: env adding
    env:
      envd: ${PWD}-{$.obj[test]}
  - name: shell with env
    shell: echo {$.envd}

This documentation provides an overview of the structure and purpose of the YAML configuration file used for defining flows and their associated actions. It can serve as a reference for users or developers working with these configurations.