Effect CommunityEC
Effect Community9mo ago
14 replies
CharLEE

Using the CLI to Access Environment Variables with Effect Typescript

How do we get envs with the CLI correctly?
const command = Command.make('t6c-mcp', {}, () =>
  pipe(
    toolkitUserReadOnly,
    Effect.flatMap((tools) =>
      Layer.launch(
        layerServerMCP({
          name: 't6c-mcp',
          version: '0.0.1',
          tools,
        }),
      ),
    ),
    Effect.provide(Layer.setConfigProvider(ConfigProvider.fromEnv())),
    Effect.provide(layerUserToolsReadOnly),
  ),
)

i have the .env file with envar and i yield the config value in my service
Was this page helpful?