Skip to content
Snippets Groups Projects
Commit 51dcb200 authored by Mark Tearle's avatar Mark Tearle
Browse files

Add documentation, tweak for production

parent beff1aa2
No related merge requests found
...@@ -118,9 +118,9 @@ function update_desec_txt($config, $name, $txt) { ...@@ -118,9 +118,9 @@ function update_desec_txt($config, $name, $txt) {
$client = new GuzzleHttp\Client([ $client = new GuzzleHttp\Client([
# 'debug' => true,
'base_uri' => 'https://desec.io', 'base_uri' => 'https://desec.io',
'timeout' => 2, 'timeout' => 2
'debug' => true
]); ]);
try { try {
...@@ -151,7 +151,19 @@ function email_api_key($username, $api_key) { ...@@ -151,7 +151,19 @@ function email_api_key($username, $api_key) {
); );
// The message // 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() // In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n"); $message = wordwrap($message, 70, "\r\n");
...@@ -167,11 +179,23 @@ $leaf = new Leaf\App(); ...@@ -167,11 +179,23 @@ $leaf = new Leaf\App();
// Add routes // Add routes
$leaf->get('/', function () use($leaf) { $leaf->get('/', function () use($leaf) {
$config=get_config(); $config=get_config();
$s = update_desec_txt($config, "mtearle-test", "test flight"); // since the response object is directly tied to the leaf instance
$r = get_desec_txt($config, "mtearle-test"); $html = <<<END
$r2 = get_desec_txt($config, "mtearle"); <h1>Quovadis</h1>
// since the response object is directly tied to the leaf instance
$html = '<h5>My first Leaf app</h5>' . $r . " --- ". $s . "----" . $r2; <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); $leaf->response()->markup($html);
}); });
......
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