davidski / vulnpryer-aws-orchestration

🎯☁️Automated deployment of a VulnPryer pipline on AWS
http://vulnpryer.net
2 stars 2 forks source link

Proper way to quote multiline json strings in cfg #8

Closed davidski closed 9 years ago

davidski commented 9 years ago

For the custom_json clause, what is the proper syntax to quote multi-line strings? I want the JSON created for this stack to have the formatting (new lines and space indents) to make this structure readable. Attempts to use the following formats have failed:

abbyyacat commented 9 years ago

ConfigParser supports multiline but leading and trailing whitespace are removed from keys and values. This means using entry below will work:

custom_json= {
        "vulnpryer" : {
                "config" : {
                        "vulndb" : {
                                "environment" : "staging",
                                "consumer_key" : "<consumer key>",
                                "consumer_secret" : "<consumer secret>"
                                },
                "s3" : {
                        "bucket_name" : "<bucket name>",
                        "key" : "<key>"
                },
                "redseal" : {
                        "username" : "<username>",
                        "password" : "<password>"
                }
        },
        "ebs" :{
                "volume_id" : "vol-45010e0d"
                }
        }
 }

but if you check them in the UI, you will be shown with this:

{
"vulnpryer" : {
"config" : {
"vulndb" : {
"environment" : "staging",
"consumer_key" : "<consumer key>",
"consumer_secret" : "<consumer secret>"
},
"s3" : {
"bucket_name" : "<bucket name>",
"key" : "<key>"
},
"redseal" : {
"username" : "<username>",
"password" : "<password>"
}
},
"ebs" :{
"volume_id" : "vol-45010e0d"
}
}
}
davidski commented 9 years ago

Great! Looks like I just needed to ensure my last line was indented from the first and configparser picked it right up. That makes things a lot more readable. :)