Skip to content

Configuration

Overview

The config format is HOCON(Human-Optimized Config Object Notation).

The config default path is './config.conf', you can change it by environment SPA_CONFIG.

Config Reference

hocon
# http bind, if set port <= 0, will disable http server(need set https config)
port = 80
addr = "0.0.0.0"

# directory to store static web files. if you use docker, please mount a persistence volume for it.
file_dir = "/data"

# enable cors, default is false, its implementation is simple now.
# Access-Control-Allow-Origin: $ORIGIN
# Access-Control-Allow-Methods: OPTION,GET,HEAD
# Access-Control-Max-Age: 3600
// cors = true

# https config, optional
//https {
//  # default value for https ssl
//  ssl {
//    # private ssl key
//    private = "private.key path",
//    # public ssl cert
//    public = "public.cert path"
//  }

//  # https bind address
//  port = 443
//  addr = "0.0.0.0"

//  # if set true, http server(80) will send client
//  # status code:301(Moved Permanently) to tell client redirect to https
//  # optional, default is false
//  http_redirect_to_https = false
//}



# default cache config
//cache {
//  # if file size > max_size, it will not be cached. default is 10485760 (10MB).
//  max_size = 10MB

//  # http header Cache-Control config,
//  # optional, if not set, won't sender this header to client
//  client_cache = [{
//    expire = 30d
//    extension_names = [icon,gif,jpg,jpeg,png,js]
//  }, {
//    // set 0, would set Cache-Control: no-cache
//    expire = 0
//    extension_names = [html]
//  }]

//  # gzip compression for js/json/icon/json, default is false,
//  # only support gzip algo, and only compress cached files,
//  # be careful to set it true
//  compression = false

//}

//# admin server config
//# admin server don't support hot reload. the config should not change.
//# optional, and it's disabled by default.
//# if you use spa-client to upload files, control version. Need to open it
//admin_config {
//# bind host
//  port = 9000
//  addr = "127.0.0.1"

//  # this is used to check client request
//  # put it in http header,  Authorization: Bearer $token
//  token = "token"

//  # max file size allowed to be uploaded,
//  # default is 30MB(30*1024*1024)
//  max_upload_size = 31457280

//  # delete deprecated version by cron
//  deprecated_version_delete {
//    # default value: every day at 3am.
//    cron: "0 0 3 * * *",
//    # default value is 2
//    max_preserve: 2,
//  }
//}


# optional, domains specfic config, it will use the default config if not set
//domains = [{
//  # domain name
//  domain: "www.example.com",
//  // optional, same with cache config, if not set, will use default cache config.
//  cache: {
//    client_cache:${cache.client_cache}
//    max_size: ${cache.max_size}
//    client_cache = ${cache.client_cache}
//  },
//  # cors
//  cors: ${cors},
//  # domain https config, if not set, will use default https config.
//  https: {
//    ssl: ${https.ssl}
//    http_redirect_to_https: ${https.http_redirect_to_https}
//  }
//}]