1

Implement a basic builder

This commit is contained in:
Evan Pratten 2023-11-13 16:06:15 -05:00
parent f60e588e2c
commit 1504038eae
2 changed files with 51 additions and 0 deletions

20
.github/workflows/ewpratten-com.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: ewpratten.com
on:
push:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Download Zola
run: |
wget https://github.com/getzola/zola/releases/download/v0.17.2/zola-v0.17.2-x86_64-unknown-linux-gnu.tar.gz -O /tmp/zola.tar.gz
tar -xvf /tmp/zola.tar.gz -C /tmp
- name: Build
run: |
cd sites/ewpratten.com
zola build

View File

@ -0,0 +1,31 @@
export default {
async fetch(request, env, ctx) {
if (request.url) {
// Construct the destination URL
let sdf_url = new URL("http://ewpratten.sdf.org");
sdf_url.pathname = (new URL(request.url)).pathname;
// Forward CF info if it exists
let headers = {};
if (request.cf) {
headers["X-CF-ASN"] = request.cf.asn;
headers["X-CF-As-Organization"] = request.cf.asOrganization;
headers["X-CF-Colo"] = request.cf.colo;
headers["X-CF-Country"] = request.cf.country;
headers["X-CF-Timezone"] = request.cf.timezone;
}
// Build a request
let sdf_request = new Request(
sdf_url,
{
headers: headers
}
);
// Fetch the content from SDF
let response = await fetch(sdf_request);
return response;
}
},
};