# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# environment can specify the sc running env, like dev or prod
environment: dev

server:
  host: 127.0.0.1
  port: 30100
  request:
    maxHeaderBytes: 32768
    maxBodyBytes: 2097152
    headerTimeout: 60s
    timeout: 60s
  response:
    timeout: 60s
  idle:
    timeout: 60s
  pprof:
    mode: 0
  limit:
    #ttl=m, s, ms
    unit: s
    #set 0 to disable rate limit
    connections: 0
    #list of places to look for IP address
    ipLookups: RemoteAddr,X-Forwarded-For,X-Real-IP

gov:
  kie:
    type: kie
    endpoint: http://127.0.0.1:30110

log:
  # DEBUG, INFO, WARN, ERROR, FATAL
  level: INFO
  file: ./service-center.log
  # access log format: remoteIp requestReceiveTime "method requestUri proto" statusCode requestBodySize delay(ms)
  # example: 127.0.0.1 2006-01-02T15:04:05.000Z07:00 "GET /v4/default/registry/microservices HTTP/1.1" 200 0 0
  # access log inherits log's rotate and backup configuration
  # whether enable access log
  # accessEnable = true
  # access log file
  accessEnable: false
  accessFile: ./access.log
  # log format(text or json type)
  format: text
  # whether enable record syslog
  system: false
  # MaxSize of a log file before rotate. By M Bytes.
  rotateSize: 20
  # Max counts to keep of a log's backup files.
  backupCount: 50

cipher:
  kind:

ssl:
  dir:
  # ssl.mode enable ssl or not, set 1 if enable
  enable: false
  # minimal tls protocol, [TLSv1.0, TLSv1.1, TLSv1.2]
  minVersion: TLSv1.2
  # ssl.verifyClient enable verify client certification CN
  verifyClient: 1
  ciphers: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_GCM_SHA256

plugin:
  # plugin.dir is the directory of the *.so files
  dir: ./plugins

registry:
  # buildin, etcd, embedded_etcd, mongo
  kind: etcd
  # registry cache, if this option value set 0, service center can run
  # in lower memory but no longer push the events to client.
  cache:
    mode: 1
    # the cache will be clear after X, if not set cache will be never clear
    ttl:
  # enabled if registry.kind equal to etcd or embedded_etcd
  etcd:
    # the interval of etcd health check, aggregation conflict check and sync loop
    autoSyncInterval: 30s
    compact:
      # indicate how many revision you want to keep in etcd
      indexDelta: 100
      interval: 12h
    cluster:
      # if registry_plugin equals to 'embedded_etcd', then
      # name: sc-0
      # managerEndpoints: http://127.0.0.1:2380"
      # endpoints: sc-0=http://127.0.0.1:2380
      # if registry_plugin equals to 'etcd', then
      # endpoints: 127.0.0.1:2379
      endpoints: http://127.0.0.1:2379
    # the timeout for failing to establish a connection
    connect:
      timeout: 10s
    # the timeout for failing to read response of registry
    request:
      timeout: 30s
  mongo:
    cluster:
      uri: mongodb://127.0.0.1:27017
      poolSize: 1000
  fastRegistration:
    # this config is only support in mongo case now
    # if fastRegister.queueSize is > 0, enable to fast register instance, else register instance in normal case
    # if fastRegister is enabled, instance will be registered asynchronously,
    # just put instance in the queue and return instanceID, and then register through the timing task
    queueSize: 0

  service:
    # globalVisible is the global microservice name list
    globalVisible:
    # retire the 'reserve' latest versions for each of service,
    # delete other versions which doesn't register any instances.
    retire:
      disable: false
      cron: '0 1 * * *'
      reserve: 3
  instance:
    # the endpoint as the service-center's endpoint instead of server.host
    endpoint:
    # By default, instance TTL = (times + 1) * interval
    # if ttl > 0, the instance will always set this value, ignore the API request body
    ttl:
    # the allowable minimum value of instance heartbeat interval
    # if interval < minInterval, instance TTL still set with minInterval
    minInterval: 5s
    datacenter:
      name:
      region:
      availableZone:
    # inner properties params for instance, sc will always append these to instance properties
    properties:

  schema:
    # if want disable Test Schema, SchemaDisable set true
    disable: false
    # remove the schema without refs every 7d
    retire:
      cron: '0 2 * * *'
  # enable to register sc itself when startup
  selfRegister: 1

# pluggable discovery service
discovery:
  kind: etcd
  aggregate:
    mode:

rbac:
  enable: false
  privateKeyFile: ./private.key
  publicKeyFile: ./public.key
  releaseLockAfter: 15m # failure login attempt causes account blocking, that is block duration
  retainLockHistoryFor: 20m # the ttl of lock history
  # specify auth resource scope, can be account,role,service,service/schema,...
  # The authenticator skip the authentication of the request, if the resource type of the request is not specified in the scope
  # The authenticator always authenticate the request with the HTTP Header 'Authorization'.
  scope: '*'

metrics:
  # enable to start metrics gather
  enable: true
  interval: 30s
  exporter: prometheus
  prometheus:
    # optional, listen another ip-port and path if set, e.g. http://127.0.0.1:80/other
    listenURL:

tracing:
  kind:
  zipkin:
    collector:
      # type should be file or server
      type:
      # the tracing file save dir path
      path:
      endpoint:
    sampler:
      rate:

quota:
  kind: buildin
  cap:
    service:
      limit: 50000
    instance:
      limit: 150000
    schema:
      limit: 100
    tag:
      limit: 100
    account:
      limit: 1000
    role:
      limit: 100

uuid:
  kind: context

auth:
  kind:


auditlog:
  kind:

heartbeat:
  # configuration of websocket long connection
  websocket:
    pingInterval: 30s
  # heartbeat.kind="checker or cache"
  # if heartbeat.kind equals to 'cache', should set cacheCapacity,workerNum and taskTimeout
  # capacity = 10000
  # workerNum = 10
  # timeout = 10
  kind: cache
  cacheCapacity: 10000
  workerNum: 10
  timeout: 10

