aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2019-12-22 03:45:39 -0500
committerThedro Neely <thedroneely@gmail.com>2019-12-22 03:45:39 -0500
commit00e758ec48e4aeea7fbd109477304cb709ad1688 (patch)
tree1d6caeab55694dabe041ff33d9bc3a35d5d856b0
parent4a7d4653a176c61b0ba07f87ecb5549f1e3b426c (diff)
downloadthedroneely.com-00e758ec48e4aeea7fbd109477304cb709ad1688.tar.gz
thedroneely.com-00e758ec48e4aeea7fbd109477304cb709ad1688.tar.bz2
thedroneely.com-00e758ec48e4aeea7fbd109477304cb709ad1688.zip
app/views/index: Move introduction to singleton
-rw-r--r--.drone.yml3
-rw-r--r--AppConfigBuild.php4
-rw-r--r--app/views/index.view.php7
-rw-r--r--bootstrap/Functions.php34
4 files changed, 31 insertions, 17 deletions
diff --git a/.drone.yml b/.drone.yml
index 538ae4c..5e9f24d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -34,6 +34,8 @@ steps:
from_secret: pgsql_username
PGSQL_PASSWORD:
from_secret: pgsql_password
+ CMS_API_TOKEN:
+ from_secret: cms_api_token
KEYBASE_VERIFICATION:
from_secret: keybase_verification
GOOGLE_SITE_VERIFICATION:
@@ -50,6 +52,7 @@ steps:
- sed -i "s|email_name|$EMAIL_NAME|" AppConfig.php
- sed -i "s|email_username|$EMAIL_USERNAME|" AppConfig.php
- sed -i "s|email_password|$EMAIL_PASSWORD|" AppConfig.php
+ - sed -i "s|cms_api_token|$CMS_API_TOKEN|" AppConfig.php
- echo "$KEYBASE_VERIFICATION" > public/.well-known/keybase.txt
- echo "$GOOGLE_SITE_VERIFICATION" > public/$(echo $GOOGLE_SITE_VERIFICATION | awk '{ print $2 }')
diff --git a/AppConfigBuild.php b/AppConfigBuild.php
index 0e83ebe..715eb48 100644
--- a/AppConfigBuild.php
+++ b/AppConfigBuild.php
@@ -17,5 +17,9 @@ return [
'name' => 'email_name',
'username' => 'email_username',
'password' => 'email_password',
+ ],
+
+ 'cms' => [
+ 'token' => 'cms_api_token',
]
];
diff --git a/app/views/index.view.php b/app/views/index.view.php
index 98eeea4..7c53d3c 100644
--- a/app/views/index.view.php
+++ b/app/views/index.view.php
@@ -43,12 +43,7 @@
<div class="content">
<p class="introduction has-text-left">
- My name is Thedro <span class="has-text-grey-dark">[/tee:dro/]</span> &mdash;
- a web developer and <a class="underline" href="https://en.wikipedia.org/wiki/Linux">linux and unix-like</a>
- system administrator.
- There are many different tools and programming languages I've come across.
- Welcome to my corner of the web. Here you'll find things I've
- worked on as well as other interesting discoveries.
+ <?php fetch('/cockpit/api/singletons/get/introduction', 'text'); ?>
</p>
<span class="quote marginnote leftnote">
diff --git a/bootstrap/Functions.php b/bootstrap/Functions.php
index 252b522..a515402 100644
--- a/bootstrap/Functions.php
+++ b/bootstrap/Functions.php
@@ -4,17 +4,29 @@
* Helper Functions
*/
-function featherIcon($name) {
- echo file_get_contents(
- $_SERVER['DOCUMENT_ROOT']
- . '/..' . '/public/css/fonts/feather-icons/' . $name . '.svg'
- );
+function featherIcon(string $name)
+{
+ echo file_get_contents(
+ $_SERVER['DOCUMENT_ROOT']
+ . '/..' . '/public/css/fonts/feather-icons/' . $name . '.svg'
+ );
}
-function base64($path) {
- echo base64_encode(
- file_get_contents($_SERVER['DOCUMENT_ROOT']
- . '/..' . $path
- )
- );
+function base64(string $path)
+{
+ echo base64_encode(
+ file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/..' . $path)
+ );
+}
+
+
+function fetch(string $path, string $field)
+{
+ $config = include $_SERVER['DOCUMENT_ROOT'] . '/..' . '/AppConfig.php';;
+ $json = file_get_contents(
+ 'http://' . $_SERVER['SERVER_NAME']
+ . $path . '?token=' . $config['cms']['token']
+ );
+ $data = json_decode($json, true);
+ echo $data[$field];
}