turbot/config

GitHub
steampipe plugin install configsteampipe plugin install config

Config + Steampipe

Config plugin is used to parse various types of configuration files, e.g., INI, JSON, YML, in order to represent the content as SQL tables.

Steampipe is an open source CLI to instantly query data using SQL.

The following file types are currently supported:

  • INI
  • JSON
  • YML

Query all data in your INI files:

select
path,
section,
key,
value
from
ini_key_value;
+----------------------------+----------+---------------+-------------------------------------------+
| path | section | key | value |
+----------------------------+----------+---------------+-------------------------------------------+
| /Users/myuser/defaults.ini | Settings | DetailedLog | 1 |
| /Users/myuser/defaults.ini | Status | RunStatus | 1 |
| /Users/myuser/defaults.ini | Status | StatusRefresh | 10 |
| /Users/myuser/defaults.ini | Status | StatusPort | 6090 |
| /Users/myuser/logs.ini | Server | Archive | 1 |
| /Users/myuser/logs.ini | Server | ServerName | Unknown |
| /Users/myuser/logs.ini | Settings | LogFile | /opt/ecs/mvuser/MV_IPTel/log/MV_IPTel.log |
| /Users/myuser/logs.ini | Settings | Version | 0.9 Build 4 Created July 11 2004 14:00 |
+----------------------------+----------+---------------+-------------------------------------------+

Query all data in your JSON files:

select
path,
jsonb_pretty(content) as file_content
from
json_file;
+----------------------------+------------------------------------------------------------+
| path | file_content |
+----------------------------+------------------------------------------------------------+
| /Users/myuser/invoice.json | { |
| | "city": "East Centerville", |
| | "date": "2012-08-06T00:00:00Z", |
| | "items": [ |
| | { |
| | "price": 1.47, |
| | "part_no": "A4786", |
| | "quantity": 4, |
| | "description": "Water Bucket (Filled)" |
| | }, |
| | { |
| | "size": 8, |
| | "price": 133.7, |
| | "part_no": "E1628", |
| | "quantity": 1, |
| | "description": "High Heeled \"Ruby\" Slippers" |
| | } |
| | ], |
| | "state": "KS", |
| | "street": "123 Tornado Alley\nSuite 16\n", |
| | "bill-to": null, |
| | "receipt": "Oz-Ware Purchase Invoice", |
| | "ship-to": null, |
| | "customer": { |
| | "first_name": "Dorothy", |
| | "family_name": "Gale" |
| | }, |
| | } |
| /Users/myuser/test.json | { |
| | "foo": "bar", |
| | "includes": [ |
| | "common.json" |
| | ] |
| | } |
+----------------------------+------------------------------------------------------------+

Query all data in your YML files:

select
path,
jsonb_pretty(content) as file_content
from
yml_file;
+---------------------------+------------------------------------------------------------+
| path | file_content |
+---------------------------+------------------------------------------------------------+
| /Users/myuser/invoice.yml | { |
| | "city": "East Centerville", |
| | "date": "2012-08-06T00:00:00Z", |
| | "items": [ |
| | { |
| | "price": 1.47, |
| | "part_no": "A4786", |
| | "quantity": 4, |
| | "description": "Water Bucket (Filled)" |
| | }, |
| | { |
| | "size": 8, |
| | "price": 133.7, |
| | "part_no": "E1628", |
| | "quantity": 1, |
| | "description": "High Heeled \"Ruby\" Slippers" |
| | } |
| | ], |
| | "state": "KS", |
| | "street": "123 Tornado Alley\nSuite 16\n", |
| | "bill-to": null, |
| | "receipt": "Oz-Ware Purchase Invoice", |
| | "ship-to": null, |
| | "customer": { |
| | "first_name": "Dorothy", |
| | "family_name": "Gale" |
| | }, |
| | } |
| /Users/myuser/test.yaml | { |
| | "foo": "bar", |
| | "includes": [ |
| | "common.yaml" |
| | ] |
| | } |
+---------------------------+------------------------------------------------------------+

Documentation

Get started

Install

Download and install the latest Config plugin:

steampipe plugin install config

Credentials

No credentials are required.

Configuration

Installing the latest config plugin will create a config file (~/.steampipe/config/config.spc) with a single connection named config:

connection "config" {
plugin = "config"
# Each paths argument is a list of locations to search for a particular file type
# All paths are resolved relative to the current working directory (CWD)
# Wildcard based searches are supported, including recursive searches.
# For example, for the json_paths argument:
# - "*.json" matches all JSON files in the CWD
# - "**/*.json" matches all JSON files in a directory, and all the sub-directories in it
# - "../*.json" matches all JSON files in in the CWD's parent directory
# - "steampipe*.json" matches all JSON files starting with "steampipe" in the CWD
# - "/path/to/dir/*.json" matches all JSON files in a specific directory
# - "/path/to/dir/main.json" matches a specific file
# If any paths include "*", all files (including non-required files) in
# the CWD will be matched and will attempt to be loaded as that
# particular file type
# All paths arguments default to CWD
ini_paths = [ "*.ini" ]
json_paths = [ "*.json" ]
yml_paths = [ "*.yml", "*.yaml" ]
}
  • ini_paths - A list of directory paths to search for INI files.
  • json_paths - A list of directory paths to search for JSON files.
  • yml_paths - A list of directory paths to search for YML files.

All paths arguments are resolved relative to the current working directory. Paths may include wildcards and also supports ** for recursive matching. Each paths argument defaults to the current working directory.

Get involved