wildebeest/scripts/generate-one-click-deploy-b...

50 wiersze
1.3 KiB
JavaScript
Czysty Zwykły widok Historia

2023-01-11 13:57:28 +00:00
const PROJECT_URL = 'https://github.com/cloudflare/wildebeest'
const ONE_CLICK_BASE_URL = 'https://deploy.workers.cloudflare.com'
const FIELDS = [
{
2023-01-11 18:16:11 +00:00
name: 'Zone ID',
2023-01-11 13:57:28 +00:00
secret: 'CF_ZONE_ID',
2023-01-11 18:16:11 +00:00
descr: 'Get your Zone ID from the Cloudflare Dashboard',
2023-01-11 13:57:28 +00:00
},
{
name: 'Domain',
secret: 'CF_DEPLOY_DOMAIN',
descr: 'Domain on which your instance will be running',
},
{
name: 'Instance title',
secret: 'INSTANCE_TITLE',
descr: 'Title of your instance',
},
{
2023-01-11 18:16:11 +00:00
name: 'Administrator Email',
2023-01-11 13:57:28 +00:00
secret: 'ADMIN_EMAIL',
2023-01-11 18:16:11 +00:00
descr: 'An Email address that can be messaged regarding inquiries or issues',
2023-01-11 13:57:28 +00:00
},
{
name: 'Instance description',
secret: 'INSTANCE_DESCR',
descr: 'A short, plain-text description of your instance',
},
]
2023-01-16 16:49:22 +00:00
const API_TOKEN_TEMPLATE = JSON.stringify([
{ key: 'd1', type: 'edit' },
{ key: 'page', type: 'edit' },
{ key: 'images', type: 'edit' },
{ key: 'access', type: 'edit' },
{ key: 'workers_kv_storage', type: 'edit' },
{ key: 'access_acct', type: 'read' },
{ key: 'dns', type: 'edit' },
{ key: 'workers_scripts', type: 'edit' },
2023-01-16 16:49:22 +00:00
])
2023-01-11 13:57:28 +00:00
const fields = FIELDS.map((x) => JSON.stringify(x))
.map((v) => `fields=${v}`)
.join('&')
2023-01-16 16:49:22 +00:00
const url = new URL(
`/?url=${PROJECT_URL}&authed=true&${fields}&apiTokenTmpl=${API_TOKEN_TEMPLATE}&apiTokenName=Wildebeest`,
ONE_CLICK_BASE_URL
)
2023-01-11 13:57:28 +00:00
console.log(url.href)