The config files in 2.0

Changing the configs and their feedback for users is one of the major topics for 2.0. Therefore I want to present a basic idea on how the future config format might looks like and I would love to hear your feedback on it. Especially things that you really disliked in the old configs and maybe how you would prefer things in 2.0.

---
log:
  level: "info"
  path: ""
server:
  baseurl: 'https://demo.codimd.org'
  port: 3000
  path: "/run/codimd/server.sock"
  # …

database:
  # URL mode
  url: "postgres://localhost/codimd"
  # OR regular config mode
  dialect: 'postgres'
  host: 'localhost'
  database: 'codimd'
storage:
  minio:
    accessKey: "something"
    secretKey: "secret"
    endpoint: "localhost"
    port: 9000
    secure: false
  s3:
    # …
features:
  freeUrlMode: false
  libravatar: true
  someMoreComplexFeature:
    myOption: "hello"
    myOtherOption: "world"
security:
  session:
    name: "connect.id"
    secret: "mysecret"
  hsts:
    enabled: true
  csp:
    directives:
      scriptSrc: 
        - "https://extras.codimd.org"

Above is an example on how I imagine our future config could, and should look like. I would love to get some more of your ideas in there :slight_smile:

I didn’t like the json like config to much so yaml is a big plus for me.

 path: ""

Does this mean to stdout?

url: "postgres://localhost/codimd"

This supports also postgres://username:password@hostname/dbname?

  path: ""

This is practially speaking a not filled variable. I left it there as I somehow didn’t come up with a good value. I don’t think an empty path should represent stdout. I have yet not come up with a syntax for stdout or alike. Maybe when people omit path or alternative we would put /dev/stdout there, but that’s also kind of broken. So not sure about that yet. Ideas are very welcome.

Yes. It’ll support the same content as dburl in CodiMD right now.

1 Like

YAML has its own set of problems, but it is certainly better than JSON. The big advantage for me will be: comments! Yes, I am serious.

2 Likes

how about path: "/" ? I think that’s very clear to anyone setting up a web service.

Unfilled variable would be path: nil or just path:.

I realized while working on the configs that we currently don’t even offer a way to decleare a log file location? So we might just omit the path entirely.