Effect CommunityEC
Effect Community2y ago
22 replies
BinaryArtifex

Using Environment Variables as Default Values in Schemas

Is it possible to use environment variables as default values? or would i need to turn this schema into a function and pass the default value in that way?

export const Resource = S.struct({
  resourceType: S.literal("schemas", "organisations", "sites"),
  resourceId: S.optional(S.Positive.pipe(S.int()), {default: () => ???}), // derive default value from Config value?
}).pipe(S.identifier("Resource"));
Was this page helpful?