# Print out and compare logged config set via env variables
env AUTHENTICATION_HEADER_NAME=X-Auth
env AUTHENTICATION_HEADER_VALUE_RE='^(.+)$'

env ALERTMANAGER_INTERVAL=10s
env ALERTMANAGER_NAME=ro
env ALERTMANAGER_URI=http://127.0.0.1:9093
env ALERTMANAGER_EXTERNAL_URI=http://127.0.0.1:9093
env ALERTMANAGER_READONLY=true
env ALERTMANAGER_TIMEOUT=10s

env ALERTACKNOWLEDGEMENT_ENABLED=true
env ALERTACKNOWLEDGEMENT_DURATION=5m
env ALERTACKNOWLEDGEMENT_AUTHOR=karma
env ALERTACKNOWLEDGEMENT_COMMENT="ACK! This alert was acknowledged via unit tests"

env ANNOTATIONS_DEFAULT_HIDDEN=true
env ANNOTATIONS_HIDDEN='help summary'
env ANNOTATIONS_VISIBLE='visible'
env ANNOTATIONS_KEEP='keep'
env ANNOTATIONS_STRIP='strip1 strip2 strip3'
env ANNOTATIONS_ORDER='summary help'
env ANNOTATIONS_ENABLEINSECUREHTML=true

env CUSTOM_CSS='/custom.css'
env CUSTOM_JS='/custom.js'

env DEBUG=false

env FILTERS_DEFAULT='@receiver=by-cluster-service @state=active'

env GRID_SORTING_ORDER=label
env GRID_SORTING_REVERSE=false
env GRID_SORTING_LABEL=severity
env GRID_AUTO_IGNORE="region instance"
env GRID_AUTO_ORDER="severity cluster"
env GRID_GROUPLIMIT=1

env KARMA_NAME=karma-demo

env LABELS_ORDER='job instance'
env LABELS_COLOR_STATIC=job
env LABELS_COLOR_UNIQUE='@receiver instance cluster'
env LABELS_KEEP='keep1 keep2'
env LABELS_KEEP_RE='keep_re1 keep_re2'
env LABELS_STRIP='strip1 strip2'
env LABELS_STRIP_RE='strip_re1 strip_re2'
env LABELS_VALUEONLY='value1 value2'
env LABELS_VALUEONLY_RE='foo.+'

env LISTEN_ADDRESS=127.0.0.1
env LISTEN_PORT=1234
env LISTEN_PREFIX='/prefix/'

env LOG_CONFIG=true
env LOG_LEVEL=info
env LOG_FORMAT=text
env LOG_TIMESTAMP=false

env RECEIVERS_KEEP='keep1 keep2'
env RECEIVERS_STRIP='strip1 strip2'

env SILENCES_EXPIRED=1s

env SILENCEFORM_STRIP_LABELS='job severity region'
env SILENCEFORM_DEFAULTALERTMANAGERS='am1'

env UI_REFRESH=10s
env UI_HIDEFILTERSWHENIDLE=false
env UI_COLORTITLEBAR=true
env UI_THEME=dark
env UI_ANIMATIONS=false
env UI_MINIMALGROUPWIDTH=300
env UI_ALERTSPERGROUP=2
env UI_COLLAPSEGROUPS=expanded
env UI_MULTIGRIDLABEL=cluster
env UI_MULTIGRIDSORTREVERSE=true

exec karma --check-config
! stdout .
cmp stderr stderr.txt

-- stderr.txt --
level=INFO msg="Version: dev"
level=INFO msg="Parsed configuration:"
level=INFO msg=authentication:
level=INFO msg="  header:"
level=INFO msg="    name: X-Auth"
level=INFO msg="    value_re: ^(.+)$"
level=INFO msg="    group_name: \"\""
level=INFO msg="    group_value_re: \"\""
level=INFO msg="    group_value_separator: ' '"
level=INFO msg="  basicAuth:"
level=INFO msg="    users: []"
level=INFO msg=authorization:
level=INFO msg="  groups: []"
level=INFO msg="  acl:"
level=INFO msg="    silences: \"\""
level=INFO msg=alertmanager:
level=INFO msg="  interval: 10s"
level=INFO msg="  servers:"
level=INFO msg="    - cluster: \"\""
level=INFO msg="      name: ro"
level=INFO msg="      uri: http://127.0.0.1:9093"
level=INFO msg="      external_uri: http://127.0.0.1:9093"
level=INFO msg="      proxy_url: \"\""
level=INFO msg="      timeout: 10s"
level=INFO msg="      proxy: false"
level=INFO msg="      readonly: true"
level=INFO msg="      tls:"
level=INFO msg="        ca: \"\""
level=INFO msg="        cert: \"\""
level=INFO msg="        key: \"\""
level=INFO msg="        insecureSkipVerify: false"
level=INFO msg="      headers: {}"
level=INFO msg="      cors:"
level=INFO msg="        credentials: include"
level=INFO msg="      healthcheck:"
level=INFO msg="        visible: false"
level=INFO msg="        filters: {}"
level=INFO msg=alertAcknowledgement:
level=INFO msg="  enabled: true"
level=INFO msg="  duration: 5m0s"
level=INFO msg="  author: karma"
level=INFO msg="  comment: '\"ACK!'"
level=INFO msg=annotations:
level=INFO msg="  default:"
level=INFO msg="    hidden: true"
level=INFO msg="  hidden:"
level=INFO msg="    - help"
level=INFO msg="    - summary"
level=INFO msg="  visible:"
level=INFO msg="    - visible"
level=INFO msg="  keep:"
level=INFO msg="    - keep"
level=INFO msg="  strip:"
level=INFO msg="    - strip1"
level=INFO msg="    - strip2"
level=INFO msg="    - strip3"
level=INFO msg="  order:"
level=INFO msg="    - summary"
level=INFO msg="    - help"
level=INFO msg="  actions: []"
level=INFO msg="  enableInsecureHTML: true"
level=INFO msg=custom:
level=INFO msg="  css: /custom.css"
level=INFO msg="  js: /custom.js"
level=INFO msg="debug: false"
level=INFO msg=filters:
level=INFO msg="  default:"
level=INFO msg="    - '@receiver=by-cluster-service'"
level=INFO msg="    - '@state=active'"
level=INFO msg=grid:
level=INFO msg="  sorting:"
level=INFO msg="    order: label"
level=INFO msg="    reverse: false"
level=INFO msg="    label: severity"
level=INFO msg="    customValues:"
level=INFO msg="      labels: {}"
level=INFO msg="  auto:"
level=INFO msg="    ignore:"
level=INFO msg="      - '\"region'"
level=INFO msg="    order:"
level=INFO msg="      - '\"severity'"
level=INFO msg="  groupLimit: 1"
level=INFO msg=history:
level=INFO msg="  enabled: true"
level=INFO msg="  workers: 30"
level=INFO msg="  timeout: 20s"
level=INFO msg="  rewrite: []"
level=INFO msg=karma:
level=INFO msg="  name: karma-demo"
level=INFO msg=labels:
level=INFO msg="  order:"
level=INFO msg="    - job"
level=INFO msg="    - instance"
level=INFO msg="  keep:"
level=INFO msg="    - keep1"
level=INFO msg="    - keep2"
level=INFO msg="  keep_re:"
level=INFO msg="    - keep_re1"
level=INFO msg="    - keep_re2"
level=INFO msg="  strip:"
level=INFO msg="    - strip1"
level=INFO msg="    - strip2"
level=INFO msg="  strip_re:"
level=INFO msg="    - strip_re1"
level=INFO msg="    - strip_re2"
level=INFO msg="  valueOnly:"
level=INFO msg="    - value1"
level=INFO msg="    - value2"
level=INFO msg="  valueOnly_re:"
level=INFO msg="    - foo.+"
level=INFO msg="  color:"
level=INFO msg="    custom: {}"
level=INFO msg="    static:"
level=INFO msg="      - job"
level=INFO msg="    unique:"
level=INFO msg="      - '@receiver'"
level=INFO msg="      - instance"
level=INFO msg="      - cluster"
level=INFO msg=listen:
level=INFO msg="  address: 127.0.0.1"
level=INFO msg="  timeout:"
level=INFO msg="    read: 10s"
level=INFO msg="    write: 20s"
level=INFO msg="  tls:"
level=INFO msg="    cert: \"\""
level=INFO msg="    key: \"\""
level=INFO msg="  port: 1234"
level=INFO msg="  prefix: /prefix/"
level=INFO msg="  cors:"
level=INFO msg="    allowedOrigins: []"
level=INFO msg=log:
level=INFO msg="  level: info"
level=INFO msg="  format: text"
level=INFO msg="  config: true"
level=INFO msg="  requests: false"
level=INFO msg="  timestamp: false"
level=INFO msg=receivers:
level=INFO msg="  keep:"
level=INFO msg="    - keep1"
level=INFO msg="    - keep2"
level=INFO msg="  keep_re: []"
level=INFO msg="  strip:"
level=INFO msg="    - strip1"
level=INFO msg="    - strip2"
level=INFO msg="  strip_re: []"
level=INFO msg=silences:
level=INFO msg="  expired: 1s"
level=INFO msg="  comments:"
level=INFO msg="    linkDetect:"
level=INFO msg="      rules: []"
level=INFO msg=silenceForm:
level=INFO msg="  strip:"
level=INFO msg="    labels:"
level=INFO msg="      - job"
level=INFO msg="      - severity"
level=INFO msg="      - region"
level=INFO msg="  defaultAlertmanagers:"
level=INFO msg="    - am1"
level=INFO msg=ui:
level=INFO msg="  refresh: 10s"
level=INFO msg="  hideFiltersWhenIdle: false"
level=INFO msg="  colorTitlebar: true"
level=INFO msg="  theme: dark"
level=INFO msg="  animations: false"
level=INFO msg="  minimalGroupWidth: 300"
level=INFO msg="  alertsPerGroup: 2"
level=INFO msg="  collapseGroups: expanded"
level=INFO msg="  multiGridLabel: cluster"
level=INFO msg="  multiGridSortReverse: true"
level=INFO msg="Configured Alertmanager source" name=ro cluster=ro uri=http://127.0.0.1:9093 proxy=false readonly=true
level=INFO msg="Configuration is valid"
