-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
signup-api -> api, finalize move to cloudflare
- Loading branch information
1 parent
7bb1388
commit fe06632
Showing
29 changed files
with
279 additions
and
1,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,6 @@ ignore | |
|
||
.DS_Store | ||
|
||
# Local Netlify folder | ||
.netlify | ||
|
||
config.local.ts | ||
.env.local | ||
.env.local.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { DmnoBaseTypes, defineDmnoService, configPath, switchBy, pickFromSchemaObject } from 'dmno'; | ||
import { CloudflarePagesEnvSchema, CloudflareWranglerEnvSchema, DmnoWranglerEnvSchema } from '@dmno/cloudflare-platform'; | ||
import { EncryptedVaultDmnoPlugin, EncryptedVaultTypes } from '@dmno/encrypted-vault-plugin'; | ||
// import { OnePasswordDmnoPlugin } from '@dmno/1password-plugin'; | ||
|
||
// we'll just use a single vault for now since it only has the 1 key - can split prod/staging later | ||
const EncryptedVault = new EncryptedVaultDmnoPlugin('vault', { | ||
key: configPath('..', 'DMNO_VAULT_KEY'), | ||
name: 'prod', | ||
}); | ||
|
||
// const onepass = new OnePasswordDmnoPlugin('1pass', { fallbackToCliBasedAuth: true }); | ||
|
||
|
||
export default defineDmnoService({ | ||
name: 'api', | ||
schema: { | ||
// these may be useful if we move over to workers, or move to another CI | ||
// ...pickFromSchemaObject(CloudflareWranglerEnvSchema, { | ||
// CLOUDFLARE_ACCOUNT_ID: { | ||
// value: onepass.itemByReference("op://Shared/Cloudflare/account id"), | ||
// }, | ||
// CLOUDFLARE_API_TOKEN: { | ||
// value: onepass.itemByReference("op://Shared/Cloudflare/workers api token"), | ||
// }, | ||
// }), | ||
DMNO_VAULT_KEY: { | ||
extends: EncryptedVaultTypes.encryptionKey, | ||
required: true, | ||
}, | ||
MAILERLITE_TOKEN: { | ||
sensitive: true, | ||
required: true, | ||
value: EncryptedVault.item(), | ||
}, | ||
MAILERLITE_GROUP_ID: { | ||
value: '112994107484276105', | ||
description: "The MailerLite group ID to add new subscribers to", | ||
externalDocs: { | ||
url: 'https://dashboard.mailerlite.com/subscribers?rules=W1t7Im9wZXJhdG9yIjoiaW5fYW55IiwiY29uZGl0aW9uIjoiZ3JvdXBzIiwiYXJncyI6WyJncm91cHMiLFsiMTEyOTk0MTA3NDg0Mjc2MTA1Il1dfV1d&group=112994107484276105&status=active', | ||
description: 'Group: All Subs' | ||
} | ||
}, | ||
...pickFromSchemaObject(CloudflarePagesEnvSchema, 'CF_PAGES_BRANCH'), | ||
|
||
DMNO_ENV: { | ||
value: () => { | ||
if (DMNO_CONFIG.CF_PAGES_BRANCH === 'main') return 'production'; | ||
if (DMNO_CONFIG.CF_PAGES_BRANCH) return 'staging'; | ||
return 'local'; | ||
}, | ||
}, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"version": "0.0.1", | ||
"keyName": "prod-2024-05-04", | ||
"items": { | ||
"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qoCHWGAoknA4rmOfVnQIM/ca3I3lMMsJp2G5wHg25WABeq+v3dGaz+P8jo7m/8PZlBFApI5VnLYTmo3N8DJrMHR6JYHpX+eiJvMLbVj+kvVA2ZK6lKHQNQyzu4ouBmJLqYJQiBLe02CiWaTeBhXCKp+N1nnV9Tmwh1P9SoTq1zUlBYbYZKcjssXJc2HH4xxDJSFoklZ/BNqyWa5jsDciQr8cuLzESBZUmG7KHLdfATGtSwv5FTZN/H29nSt0WcdWsL9VaWzgrJyo5e5roGBuxt6nm3s5AIXXV9RNF6lfrUOgjAJ", | ||
"updatedAt": "2024-05-04T20:04:43.857Z" | ||
}, | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
functions-dist | ||
functions/*.js | ||
functions/*.map | ||
.wrangler | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# DMNO cloud api | ||
|
||
A simple api designed to run on Cloudflare Pages. | ||
|
||
Currently this just handles a single endpoint to subscribe folks to our mailing list, but this will be where we can start to deal with user logins and persisting settings/state. | ||
|
||
|
||
### Why not Cloudflare Workers? | ||
|
||
Ideally this would be running on Workers, but the Pages CI dev ex is much better. We will migrate over when the [Workers builds](https://developers.cloudflare.com/workers/ci-cd/builds/) catches up to pages. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const onRequest: PagesFunction = async (context) => { | ||
return new Response(JSON.stringify({ apiStatus: 'ok' }), { status: 200 }); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"lib": [ "esnext" ], | ||
"types": [ "@cloudflare/workers-types" ] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
20 changes: 7 additions & 13 deletions
20
packages/signup-api/package.json → packages/dmno-api/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
{ | ||
"name": "@dmno/signup-api", | ||
"name": "@dmno/api", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "dmno run -- tsup", | ||
"dev": "pnpm --filter=\"@dmno/signup-api\" run --parallel \"/dev:*/\" ", | ||
"build-for-deploy": "turbo run --filter=@dmno/api... --filter=\"!@dmno/api\" build && pnpm run build && mkdir dist", | ||
"dev": "pnpm --filter=\"@dmno/api\" run --parallel \"/dev:*/\" ", | ||
"dev:ts": "dmno run -w -- pnpm run build --watch", | ||
"dev:netlify": "netlify dev", | ||
"dev:wrangler": "wrangler pages dev", | ||
"deploy": "dwrangler pages deploy", | ||
"lint": "eslint src --ext .ts,.cjs,.astro,.md,.mdx", | ||
"lint:fix": "pnpm run lint --fix" | ||
}, | ||
"dependencies": { | ||
"@dmno/ts-lib": "workspace:*", | ||
"async": "^3.2.5", | ||
"axios": "^1.6.8", | ||
"emailvalid": "^1.0.4", | ||
"google-auth-library": "^9.9.0", | ||
"google-spreadsheet": "^4.1.1" | ||
"emailvalid": "^1.0.4" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^4.20241112.0", | ||
"@cloudflare/workers-types": "^4.20250109.0", | ||
"@dmno/cloudflare-platform": "workspace:*", | ||
"@dmno/encrypted-vault-plugin": "workspace:*", | ||
"@dmno/1password-plugin": "workspace:*", | ||
"@dmno/eslint-config": "workspace:*", | ||
"@dmno/tsconfig": "workspace:*", | ||
"@netlify/functions": "^2.6.3", | ||
"@types/async": "^3.2.24", | ||
"dmno": "workspace:*", | ||
"netlify-cli": "^17.1.0", | ||
"tsup": "catalog:", | ||
"typescript": "catalog:", | ||
"wrangler": "^3.96.0" | ||
"wrangler": "^3.102.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"exclude": [ "functions-src/**/*.ts" ], | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"lib": [ "esnext" ], | ||
"baseUrl": ".", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = "dmno-api" | ||
pages_build_output_dir = "dist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.