Commit 51dcb200 authored by Mark Tearle's avatar Mark Tearle

Add documentation, tweak for production

parent beff1aa2
......@@ -118,9 +118,9 @@ function update_desec_txt($config, $name, $txt) {
$client = new GuzzleHttp\Client([
# 'debug' => true,
'base_uri' => 'https://desec.io',
'timeout' => 2,
'debug' => true
'timeout' => 2
]);
try {
......@@ -151,7 +151,19 @@ function email_api_key($username, $api_key) {
);
// The message
$message = "Quovadis\r\n\r\nUCC DNS Helper\r\nYour API key is: $api_key";
$message = <<<END
Quovadis
UCC DNS Helper
Your API key is: $api_key;
Rough API usage is:
curl -X POST -d username=accmurphy https://quovadis.ucc.asn.au/register
curl -X POST -d username=accmurphy -d api_key=foo -d new_api_key=bar https://quovadis.ucc.asn.au/update-api-key
curl -X POST -d username=accmurphy -d api_key=foo -d challenge=thingy -d value=123456abcdef https://quovadis.ucc.asn.au/update-challenge
END;
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");
......@@ -167,11 +179,23 @@ $leaf = new Leaf\App();
// Add routes
$leaf->get('/', function () use($leaf) {
$config=get_config();
$s = update_desec_txt($config, "mtearle-test", "test flight");
$r = get_desec_txt($config, "mtearle-test");
$r2 = get_desec_txt($config, "mtearle");
// since the response object is directly tied to the leaf instance
$html = '<h5>My first Leaf app</h5>' . $r . " --- ". $s . "----" . $r2;
// since the response object is directly tied to the leaf instance
$html = <<<END
<h1>Quovadis</h1>
<h2>UCC DNS Helper</h2>
<p>
Rough API usage is:
</p>
<pre>
curl -X POST -d username=accmurphy https://quovadis.ucc.asn.au/register
curl -X POST -d username=accmurphy -d api_key=foo -d new_api_key=bar https://quovadis.ucc.asn.au/update-api-key
curl -X POST -d username=accmurphy -d api_key=foo -d challenge=thingy -d value=123456abcdef https://quovadis.ucc.asn.au/update-challenge
</pre>
END;
$leaf->response()->markup($html);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment