Skip to content

AdminConfig

Thiago da Rosa de Bustamante edited this page Mar 27, 2018 · 9 revisions

It is used in the GatewayConfig to configure the Admin Service for the Gateway.

It support the following properties:

Property Type Description Required
protocol ProtocolConfig The protocol configuration for the admin module. true
userService UsersConfig Configurations for admin users service. true
accessLogger AccessLoggerConfig Configurations for admin access log. false
apiDocs ApiDocs If provided, the service will publish all api documentation under the informed path. false
cors CorsConfig Configure cors support for Admin API requests. false
filter MiddlewareConfig[] An array of installed Filter middlewares to be executed, in order, by the request pipeline. false

UsersConfig

Configure the service used to manage the users that can access the admin tasks.

It support the following properties:

Property Type Description Required
jwtSecret string The secret or a path to a secret key used to generate JWT tokens for users authentication. true

ApiDocs

If provided, configure how to publish the api documentation.

It support the following properties:

Property Type Description Required
path string The path where deploy the docs. true
host string The hostname where swagger will point the operations. false

If the host is not provided, the swagger file will point all operations to the hostname of the machine running the service.

Example:

{
    "admin": {
        "protocol": {
            "https": {
                "listenPort": 8001,
                "privateKey": "./server.key",
                "certificate": "./server.crt"                        
            }
        },
        "accessLogger": {
            "msg": "HTTP {{req.method}} - {{res.statusCode}} - {{req.url}} ({{res.responseTime}}ms) ",
            "console": {
                "timestamp": true,
                "colorize": true
            },
            "file": {
                "timestamp": true,
                "json": false,
                "prettyPrint": true,
                "outputDir": "./logs"
            }
        },
        "userService": {
            "jwtSecret": "secret"
        },
        "apiDocs": {
            "path": "api-docs",
            "host": "localhost"
        },
        "cors" : {
            "origin": {
                "allow": [{
                    "value": "*"
                }]
            }
        }, 
        "filter": [{
            "name": "ipFilter",
            "options": {
                "whitelist": ["127.0.0.1", "::1" ]
            }
        }]
    }
}

or

admin:
  protocol:
    https:
      listenPort: 8001
      privateKey: "./server.key"
      certificate: "./server.crt"
  accessLogger:
    msg: 'HTTP {{req.method}} - {{res.statusCode}} - {{req.url}} ({{res.responseTime}}ms) '
    console:
      timestamp: true
      colorize: true
    file:
      timestamp: true
      json: false
      prettyPrint: true
      outputDir: "./logs"
  userService:
    jwtSecret: secret
  apiDocs:
    path: api-docs
    host: localhost
  cors:
    origin:
      allow:
      - value: "*"
  filter:
    - name: ipFilter 
      options: 
        whitelist: 
          - "127.0.0.1"
          - "::1"      
Clone this wiki locally