Savory/Danet

Environment variables not loaded from .env file

Closed this issue · 4 comments

The .env file is not functioning correctly or is not being imported with PostgreSQL. The following error appears in the console:

error: Uncaught (in promise) ConnectionParamsError: Missing connection parameters: database, user
    throw new ConnectionParamsError(missing_params_message);
          ^
    at assertRequiredOptions (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/connection_params.ts:165:11)
    at createParams (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/connection_params.ts:452:3)
    at new Client (https://jsr.io/@bartlomieju/postgres/0.17.2/client.ts:484:22)
    at PostgresService.onAppBootstrap (file:///home/user/example/src/database/postgres.service.ts:12:19)
    at HookExecutor.executeInstanceHook (https://jsr.io/@danet/core/2.4.3/src/hook/executor.ts:24:30)
    at HookExecutor.executeHookForEveryInjectable (https://jsr.io/@danet/core/2.4.3/src/hook/executor.ts:17:15)
    at DanetApplication.init (https://jsr.io/@danet/core/2.4.3/src/app.ts:120:27)
    at async bootstrap (file:///home/user/example/src/bootstrap.ts:8:3)
    at async file:///home/user/example/run.ts:3:21

To reproduce the issue:

  1. Follow the steps as indicated in the official documentation section overview/first steps.
  2. Set up a new .env file based on .env.example.
  3. Run deno task launch-server.

Expected behavior: The server should start and display the addresses to access it.

I've done some research, and it seems the issue is with danet-cli. The default template appears to need to include dotenv with jsr:. I will open an issue in the danet-cli repository.

my bad, I found at Danet-Starter repository

Must be handled in Danet/Starter repository