# Configuration as YAML

In Socrates, when you connect to github, you have the ability to dynamically create components define by `.yaml` files. These files, alongside the code files describe your entire Socrates infrastructure.

<div align="left"><img src="https://1971768033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVaIfG2Rerp9OfcB9UQTT%2Fuploads%2F9UXjKEPS5pcySh7923jN%2FScreen%20Shot%202022-04-21%20at%2016.00.57.png?alt=media&#x26;token=15fc7b3e-3b6c-4e29-adbe-29466413eb8c" alt=""></div>

There are 4 types of Components you can make using this type of integration:

* Block (filenam&#x65;**.block.yaml**):

{% hint style="warning" %}
You must enable "Create dynamic/shared parameters" in the Settings page if you define a block with non-existing shared/dynamic parameters. Otherwise, the block will be added without.
{% endhint %}

```yaml
name: Example Block # Unique name of the block as will appear in the UI
lang: bash # Code language, needs to pre-exist in socrates
parameters:
  - key: textparam
    value: a text
    type: text # text parameter, not shared
    secret: true
  - key: boolparam
    value: true
    type: bool # boolean parameter
  - key: multiparam
    value:
      - option1
      - option2
      - option3
    type: multi # multiple choice parameter and options
  - key: sharedparam
    value: shared text
    secret: false
    type: shared
  - key: dynamic 
    lang: bash
    value: |
      echo "::set-output result=[a,b,c]"
    type: dynamic # dynamic parameter and options. 
    # Currently there is no default. to create a default, assign one to an instance.
script:
  github: integrations/trigger_jenkins.py # EITHER this
  code: | # OR this
    env
prescript:
  enabled: true # Enabled a pre-script in bash
  script: |
    echo this is a pre script
desc: | # description
  a block created from git integration
image: existing_icon.png # Image, if it exists
```

* Instance (filenam&#x65;**.instance.yaml**):

```yaml
name: Example Instance
block: Example Block # Must exist either in Github or the UI
schedule: 0/1 * * * * # optional
parameters:
    # Override a specific parameter, can be any kind except shared/dynamic
  - key: param_name 
    value: override value
desc: |
  an instance created from git integration
image: existing_icon.png
```

* Step Flow (filenam&#x65;**.step.yaml**):

```yaml
steps:
  - - name: Example Instance # - - two lines indicate the start of a step
    - name: Example Instance
  - - name: Example Instance
name: Example Step
schedule: 0/1 * * * * # optional
on_error: continue # continue / stop
desc: |
  a step flow created from github
image: 256.png
```

* Dag Flow (filenam&#x65;**.dag.yaml**):

```yaml
nodes:
  - name: Example Instance
    children:
      name: Example Instance 2
      children:
        - name: Example Instance
        - name: Example Instance 2
          children:
            - name: Example Instance
            - name: Example Instance        
  - name: Example Instance 2
    children:
      name: Example Instance      
name: Example Dag
on_error: continue # continue / branch / tree
schedule: 0/1 * * * * # optional
desc: |
  a dag flow created from github
image: test.png
```
