본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

선언형 구성 파일에 패치 적용

원문 보기 위키 갱신

선언형 구성 파일에 패치 적용 (kongctl patch file)

kongctl patch file 명령은 선언형 구성 파일에 패치를 적용하는 기능이에요. JSONPath 스타일 선택자(-s)와 값 지정(-v)을 조합하면 서비스 타임아웃 설정처럼 특정 경로의 값을 바꾸거나, 키를 제거하거나, 배열에 항목을 추가할 수 있어요. 여러 패치 파일을 순서대로 적용하거나 stdin으로 입력을 받고, 결과를 YAML 또는 JSON 형식으로 출력하는 것도 가능해요

출처: 문서

본문

명령어 사용법

Usage:
  kongctl patch file <input-file> [patch-files...] [flags]

Examples:
  # Set timeouts on all services
  kongctl patch file kong.yaml -s '$..services[*]' -v 'read_timeout:30000'
  
  # Set multiple values
  kongctl patch file kong.yaml -s '$..services[*]' -v 'read_timeout:30000' -v 'write_timeout:30000'
  
  # Remove a key from the root object
  kongctl patch file config.yaml -s '$' -v 'debug:'
  
  # Append to an array
  kongctl patch file kong.yaml -s '$..routes[*].methods' -v '["OPTIONS"]'
  
  # Apply a patch file
  kongctl patch file kong.yaml patches.yaml
  
  # Apply multiple patch files in order
  kongctl patch file kong.yaml base.yaml env.yaml team.yaml
  
  # Read from stdin, write to a file
  cat kong.yaml | kongctl patch file - -s '$' -v 'version:"2.0"' --output-file output.yaml
  
  # Output as JSON
  kongctl patch file kong.yaml patches.yaml --format json --output-file output.json


Flags:
      --color-theme string      Configures the CLI UI/theme (prompt, tables, TUI elements).
                                - Config path: [ color-theme ]
                                - Examples   : [ auto, 3024_day, 3024_night, aardvark_blue, abernathy ]
                                - Reference  : [ https://github.com/lrstanley/bubbletint/blob/master/DEFAULT_TINTS.md ] (default "auto")
      --config-file string      Path to the configuration file to load.
                                - Environment variable: KONGCTL_CONFIG_FILE (overridden by this flag)
                                - Default: [ $XDG_CONFIG_HOME/kongctl/config.yaml ]
      --format string           Output format: yaml or json (default "yaml")
  -h, --help                    help for file
      --log-file string         Write execution logs to the specified file instead of STDERR.
                                - Config path: [ log-file ]
      --log-level string        Configures the logging level. Execution logs are written to STDERR.
                                - Config path: [ log-level ]
                                - Allowed    : [ trace|debug|info|warn|error ] (default "error")
      --no-telemetry            Disable telemetry for this command invocation. Overrides config and env.
                                - Config path: [ telemetry.enabled ]
                                - Env var    : [ KONGCTL_NO_TELEMETRY ]
                                - Default    : [ false ]
      --no-trunc                Preserve full cell widths in static text tables beyond terminal width.
                                Does not change column selection, UUID formatting, or explicit string slices.
                                - Config path: [ text.no-trunc ]
                                - Default    : [ false ]
  -o, --output string           Configures the format of data written to STDOUT.
                                - Config path: [ output ]
                                - Allowed    : [ json|yaml|text ] (default "text")
      --output-file string      Output file path (default: stdout) (default "-")
  -p, --profile string          Specify the profile to use for this command. (default "default")
  -s, --selector stringArray    JSONPath expression to select target nodes (repeatable)
      --text-id-format string   Configure UUID rendering in static text-table ID columns.
                                - Config path: [ text.id-format ]
                                - Allowed    : [ compact|full ]
                                - Default    : [ compact ]
      --text-layout string      Configure static text-table column selection.
                                - Config path: [ text.layout ]
                                - Allowed    : [ compact|auto|wide ]
                                - Default    : [ compact ]
  -v, --value stringArray       Value to set: "key:json-value", "key:" (remove), or "[values]" (append). Repeatable.

관련 리소스

더 알아보기 (Learn more)