github.com/outbrain/consul@v1.4.5/website/source/docs/commands/kv/import.html.markdown.erb (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Commands: KV Import"
     4  sidebar_current: "docs-commands-kv-import"
     5  ---
     6  
     7  # Consul KV Import
     8  
     9  Command: `consul kv import`
    10  
    11  The `kv import` command is used to import KV pairs from the JSON representation
    12  generated by the `kv export` command.
    13  
    14  ## Usage
    15  
    16  Usage: `consul kv import [options] [DATA]`
    17  
    18  #### API Options
    19  
    20  <%= partial "docs/commands/http_api_options_client" %>
    21  <%= partial "docs/commands/http_api_options_server" %>
    22  
    23  ## Examples
    24  
    25  To import from a file, prepend the filename with `@`:
    26  
    27  ```
    28  $ consul kv import @values.json
    29  # Output
    30  ```
    31  
    32  To import from stdin, use `-` as the data parameter:
    33  
    34  ```
    35  $ cat values.json | consul kv import -
    36  # Output
    37  ```
    38  
    39  You can also pass the JSON directly, however care must be taken with shell
    40  escaping:
    41  
    42  ```
    43  $ consul kv import "$(cat values.json)"
    44  # Output
    45  ```
    46  
    47