Skip to main content

JSON Composer

Project description

jose5

JSON Composer

The fifth José in Aplazame

Example

The following file, dev.json ...

{
    "__extends": "./base.json",
    "__variables": {
        "ENVIRONMENT": "dev",
        "tfstate": {
            "with": {
                "stuff": 42
            }
        }
    },
    "environment": [
        {
            "name": "LOG_LEVEL",
            "value": "DEBUG"
        },
        {
            "name": "EXTRA_DEVELOPMENT_PARAM",
            "value": 20
        },
        {
            "name": "TFSTATE_STUFF",
            "value": "${tfstate.with.stuff}"
        }
    ],
    "secrets": [
        {
            "name": "SECRET_KEY",
            "valueFrom": "${PARAM_BASE_PATH}/SECRET_KEY"
        }
    ],
    "mergemap": {
        "b": "dev",
        "c": "dev"
    },
    "list": "${LIST_TEST}",
    "map": "${LIST_MAP}"
}

... with base.json

{
    "__variables": {
        "PARAM_BASE_PATH": "/app/${ENVIRONMENT}",
        "LIST_TEST": [
            1,
            2,
            3
        ],
        "LIST_MAP": {
            "a": 44
        }
    },
    "environment": [
        {
            "name": "ENVIRONMENT",
            "value": "${ENVIRONMENT}"
        },
        {
            "name": "LOG_LEVEL",
            "value": "INFO"
        }
    ],
    "mergemap": {
        "a": "base",
        "b": "base"
    }
}

... produces this result

{
  "environment": [
    {
      "name": "ENVIRONMENT",
      "value": "dev"
    },
    {
      "name": "LOG_LEVEL",
      "value": "DEBUG"
    },
    {
      "name": "EXTRA_DEVELOPMENT_PARAM",
      "value": 20
    },
    {
      "name": "TFSTATE_STUFF",
      "value": 42
    }
  ],
  "mergemap": {
    "a": "base",
    "b": "dev",
    "c": "dev"
  },
  "secrets": [
    {
      "name": "SECRET_KEY",
      "valueFrom": "/app/dev/SECRET_KEY"
    }
  ],
  "list": [
    1,
    2,
    3
  ],
  "map": {
    "a": 44
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jose5-0.4.0.tar.gz (3.5 kB view hashes)

Uploaded source

Built Distribution

jose5-0.4.0-py3-none-any.whl (3.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page