mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
feat: Add image transforms
This commit is contained in:
@@ -4,6 +4,7 @@ import { domain } from "./dns";
|
||||
import { secret } from "./secret";
|
||||
import { cluster } from "./cluster";
|
||||
import { postgres } from "./postgres";
|
||||
import { storage } from "./storage";
|
||||
|
||||
export const apiService = new sst.aws.Service("Api", {
|
||||
cluster,
|
||||
@@ -12,6 +13,7 @@ export const apiService = new sst.aws.Service("Api", {
|
||||
link: [
|
||||
bus,
|
||||
auth,
|
||||
storage,
|
||||
postgres,
|
||||
secret.SteamApiKey,
|
||||
secret.PolarSecret,
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
import {api} from "./api"
|
||||
import { domain } from "./dns";
|
||||
import { storage } from "./storage";
|
||||
|
||||
const cache = new sst.cloudflare.Kv("ImageCache");
|
||||
|
||||
const bucket = new sst.cloudflare.Bucket("ImageBucket");
|
||||
|
||||
const imageRouter = new sst.aws.Router("ImageRouter", {
|
||||
routes: {
|
||||
"/*": {
|
||||
bucket: storage,
|
||||
rewrite: { regex: "^/([a-zA-Z0-9_-]+)$", to: "/images/$1" },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const imageCdn = new sst.cloudflare.Worker("ImageCDN", {
|
||||
url: true,
|
||||
domain: "cdn." + domain,
|
||||
link: [bucket, cache, imageRouter],
|
||||
link: [bucket, cache, api],
|
||||
handler: "packages/functions/src/images/index.ts",
|
||||
});
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
export const storage = new sst.aws.Bucket("Storage",{
|
||||
access: "cloudfront",
|
||||
});
|
||||
export const storage = new sst.aws.Bucket("Storage");
|
||||
Reference in New Issue
Block a user