1- import { config } from '@stacksjs/config'
21import { BentoCache , bentostore } from 'bentocache'
32import { dynamoDbDriver } from 'bentocache/drivers/dynamodb'
43import { BaseCacheDriver } from './base'
@@ -13,26 +12,19 @@ export interface DynamoDBOptions {
1312
1413export class DynamoDBCacheDriver extends BaseCacheDriver {
1514 constructor ( options : DynamoDBOptions = { } ) {
16- // Use environment variables with fallbacks
17- const awsAccessKeyId = options . accessKeyId ?? config . cache . drivers ?. dynamodb ?. key ?? 'dummy'
18- const awsSecretAccessKey = options . secretAccessKey ?? config . cache . drivers ?. dynamodb ?. secret ?? 'dummy'
19- const dynamoEndpoint = options . endpoint ?? config . cache . drivers ?. dynamodb ?. endpoint ?? 'http://localhost:8000'
20- const tableName = options . tableName ?? config . cache . drivers ?. dynamodb ?. table ?? 'stacks'
21- const region = options . region ?? config . cache . drivers ?. dynamodb ?. region ?? 'us-east-1'
22-
2315 const client = new BentoCache ( {
2416 default : 'dynamo' ,
2517 stores : {
2618 dynamo : bentostore ( ) . useL2Layer (
2719 dynamoDbDriver ( {
28- endpoint : dynamoEndpoint ,
29- region,
20+ endpoint : options . endpoint ?? 'http://localhost:8000' ,
21+ region : options . region ?? 'us-east-1' ,
3022 table : {
31- name : tableName ,
23+ name : options . tableName ?? 'stacks' ,
3224 } ,
3325 credentials : {
34- accessKeyId : awsAccessKeyId ,
35- secretAccessKey : awsSecretAccessKey ,
26+ accessKeyId : options . accessKeyId ?? 'dummy' ,
27+ secretAccessKey : options . secretAccessKey ?? 'dummy' ,
3628 } ,
3729 } ) ,
3830 ) ,
0 commit comments