diff options
-rw-r--r-- | .drone.yml | 3 | ||||
-rw-r--r-- | AppConfigBuild.php | 4 | ||||
-rw-r--r-- | app/views/index.view.php | 7 | ||||
-rw-r--r-- | bootstrap/Functions.php | 34 |
4 files changed, 31 insertions, 17 deletions
@@ -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> — - 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]; } |