Skip to content

Configuration

Ilmar Türk edited this page Dec 13, 2024 · 4 revisions

Citizen OS API configuration guidelines

DB

We use Sequelize, see the documentation here - https://sequelize.org/docs/v6/getting-started/ Code that initiates the DB connection - https://github.com/citizenos/citizenos-api/blob/master/db/models/index.js

URL

Example configuration for URL based configuration:

  "db": {
    "url": "postgres://citizenos:citizenos@localhost:5432/citizenos"
  }

Peer authentication

Example configuration for peer authentication (unix domain socket):

  "db": {
    "url": null,
    "options": {
      "host": "/var/run/postgresql",
      "database": "citizenos",
      "dialectOptions": {
        "ssl": false
      }
    }
  }

File upload

File upload is used for uploading files where necessary. Eg. include attachments to topics or add user profile or group image. Example configuration for file upload:

Local example config

   "storage": {
    "type": "local",
    "allowedFileTypes": ["txt", "pdf", "doc", "docx", "ddoc", "bdoc", "odf", "odt", "jpg", "jpeg", "img", "png"],
    "maxFileSize": 50000,
    "baseFolder": "/path/to/folder/in/file/system/",
    "baseURL": "https://myhost.site.com/imagefolder/"
  }

Amazon S3 example config

   "storage": {
    "type": "s3",
    "accessKeyId": "myAccessKeyId",
    "secretAccessKey": "myAccessKeySecret",
    "region": "myRegion",
    "bucket": "myBucket",
    "allowedFileTypes": ["txt", "pdf", "doc", "docx", "ddoc", "bdoc", "odf", "odt", "jpg", "jpeg", "img", "png"],
    "maxFileSize": 50000
  }
Clone this wiki locally