# Storages

  • storagesCore : for store Alert data and KV data
  • storagesUpload : for upload files (usually images)
  • HCL
  • Yaml
storagesCore {
  sqlite "mySqliteStorage" {
    path = "/path/to/file"
    timeout = 1000
    tableKV {
      table = "kv"
      fields {
        key = "key"
        value = "value"
      }
    }
    tableAlerts {
      table = "alerts"
      fields {
        name = "id"
        level = "level"
        count = "count"
        createdAt = "created_at"
        updatedAt = "updated_at"
      }
    }
  }
  
  postgres "pg1" {
    host = "domain.com"
    port = 5432
    username = "username"
    password = "password"
    database = "database"
    sslMode = "verify-full"
    sslCertPath = "/path/to/cert.crt"
    timeout = 3000
    tableKV = {} // same as sqlite above
    tableAlerts = {} // same as sqlite above
  }
}

storagesUpload {
  s3 "dev" {
    region = "us-east1"
    key = "SOME_KEY"
    secret = "SOME_SECRET"
    endpoint = "SOME_ENDPOINT"
    bucket = "SOME_BUCKET"
  }
}

# Core

Core storage is for storing Alerts and KV data

It supports 2 types: sqlite and postgres

For each of these types you should define tables and fields for storing Alerts and KV data

You do not have direct access to these storages from your scripts

# Upload

Upload storage use for uploading any data from your scripts.

TIP

At the moment supports only uploadPNG method

For example:

local storage = require('storage.s3.myUploadStorage')
-- ...
imageURL, err = storage.uploadPNG(binaryData)
Last Updated: 2/15/2022, 1:04:22 PM