Add different gallery layouts
This commit is contained in:
		
							
								
								
									
										21
									
								
								src/lib/s3.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/lib/s3.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
import { GetObjectCommand, S3Client } from "@aws-sdk/client-s3";
 | 
			
		||||
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
 | 
			
		||||
 | 
			
		||||
export const s3 = new S3Client({
 | 
			
		||||
  region: "us-east-1",
 | 
			
		||||
  endpoint: "http://10.0.20.11:9010",
 | 
			
		||||
  forcePathStyle: true,
 | 
			
		||||
  credentials: {
 | 
			
		||||
    accessKeyId: "fellies",
 | 
			
		||||
    secretAccessKey: "XCJ7spqxWZhVn8tkYnfVBFbz2cRKYxPAfeQeIdPRp1",
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export async function getSignedImageUrl(key: string, expiresInSec = 3600) {
 | 
			
		||||
  const command = new GetObjectCommand({
 | 
			
		||||
    Bucket: "gaertan",
 | 
			
		||||
    Key: key,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return getSignedUrl(s3, command, { expiresIn: expiresInSec });
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user