4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

deckの出力結果をシンプルに

Last updated at Posted at 2025-12-04

本記事は「Kong Advent Calendar 2025」の5日目のエントリとして、deckの出力結果をシンプルにする方法について解説する。

Kong Gatewayを使っていると、deck CLIでKong Gateway環境の設定値をdump出力してバックアップとして利用したり、設定のマイグレーションなどに利用することは多いと思う。
また、dump出力してそのファイルを加工してデプロイし直すなんてこともあると思う。
ただ、dump出力の難点として、デフォルト値を含めて表示するので可読性にやや難があったりした。
以下はOIDC Pluginの例(抜粋)であるが、どこを設定した箇所かは簡単には分からない。

    plugins:
    - config:
        anonymous: null
        audience: null
        audience_claim:
        - aud
        audience_required: null
        auth_methods:
        - password
        - client_credentials
        - authorization_code
        - bearer
        - introspection
        - userinfo
        - kong_oauth2
        - refresh_token
        - session
        authenticated_groups_claim: null
        authorization_cookie_domain: null
        authorization_cookie_http_only: true
        authorization_cookie_name: authorization
        authorization_cookie_path: /
        authorization_cookie_same_site: Default
        authorization_cookie_secure: null
        authorization_endpoint: null
        authorization_query_args_client: null
        :(省略)

この問題だが、先日リリースされたv1.53でついに解消されることとなった。
deck gateway dump時に--skip-defaultsをつけることでデフォルト値が省略される。
上記のOIDC Plugin環境に対して--skip-defaultsをつけて実行した結果はこちら。

    plugins:
    - config:
        cache_tokens_salt: TtZOX6s5fq9D5rhDW4bHpIsD023OR78y
        client_id:
        - dd33efb6-85e9-xxxx
        client_secret:
        - vNs8Q~xxxx
        display_errors: true
        issuer: https://login.microsoftonline.com/xxxx/v2.0/.well-known/openid-configuration
        issuers_allowed:
        - https://sts.windows.net/xxxx/
        - https://login.microsoftonline.com/xxxx/v2.0
        - https://login.windows.net/xxxx/v2.0
        redirect_uri:
        - https://httpbin.org/
        scopes:
        - openid
        - email
        - profile
        - dd33efb6-85e9-xxxx/.default
      enabled: true
      name: openid-connect

非常にシンプルになった。
デフォルト値が必要なケースの方が少ないと思うので、積極的に--skip-defaultsを使っていくといいと思う。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?