forked from ascorbic/secrets-test
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
63 lines (56 loc) · 1.78 KB
/
Copy pathindex.html
File metadata and controls
63 lines (56 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<h1>Authlify Secrets Test</h1>
<h2>Setup:</h2>
<ol>
<li>
Be sure to enable
<a href="https://authlify-dev.netlify.app/" target="_blank">Authlify</a> for
<code class="hostname">localhost</code>
</li>
<li>
This will trigger a new deploy (<a
id="deployLink"
href="https://app.netlify.com/"
target="_blank"
>you can check here</a
>) so the new env var takes effect
</li>
</ol>
<h2>Usage</h2>
<ul>
<li>
Hit the secrets endpoint:
<code
>curl "https://<span class="hostname">localhost</span
>.netlify.app/.netlify/functions/secrets"</code
>
</li>
<li>
Hit the conditional secrets endpoint to see the current time overhead to
fetch the secrets:
<code
>curl "https://<span class="hostname">localhost</span
>.netlify.app/.netlify/functions/conditionalSecrets?skipSecrets=true"</code
>
</li>
<li>
Hit the "Add Issue Comment" endpoint to leave a comment on the
<a href="https://github.com/sgrove/blog/issues/66">test issue</a>:
<code
>curl "https://<span class="hostname">localhost</span
>.netlify.app/.netlify/functions/addIssueComment?comment=Hi+there"</code
>
</li>
</ul>
<script type="application/javascript">
function getHostname() {
return window.location.hostname.split(".netlify.app")[0];
}
// Get all elements with "hostname" class
var hostnameElements = document.getElementsByClassName("hostname");
// Loop through all elements with "hostname" class and set their innerHTML to the current hostname
for (var i = 0; i < hostnameElements.length; i++) {
hostnameElements[i].innerHTML = getHostname();
}
const deployUrl = `https://app.netlify.com/sites/${getHostname()}/deploys?filter=main`;
document.getElementById("deployLink").href = deployUrl;
</script>