Implement a basic builder
This commit is contained in:
parent
f60e588e2c
commit
1504038eae
20
.github/workflows/ewpratten-com.yml
vendored
Normal file
20
.github/workflows/ewpratten-com.yml
vendored
Normal 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
|
31
sites/sdf.ewpratten.com/_worker.js
Normal file
31
sites/sdf.ewpratten.com/_worker.js
Normal 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;
|
||||
}
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user