Effect CommunityEC
Effect Community2y ago
9 replies
danielo515

Handling Config Error in Inferred Layer

If I have a layer that is inferred to have a Config error, where should I remove it?
On the runtime? Or directly on the layer like this?
export const live = Layer.effect(
  FileUploadService,
  Effect.gen(function* (_) {
    const { bucket, region, accessKeyId, secretAccessKey } = yield* Config.all({
      bucket: Config.string("S3_BUCKET"),
      region: Config.string("AWS_REGION"),
      accessKeyId: Config.string("AWS_ACCESS_KEY_ID"),
      secretAccessKey: Config.string("AWS_SECRET_ACCESS_KEY"),
    });
//....
    return FileUploadService.of({ upload });
  }),
).pipe(() => Effect.orDie);
Was this page helpful?