With loading dot env in sqx-ts
Hi! If i understand correctly, i just need to create a .env file for sqx-ts to load environment variables and run the script. However, something is not working as expected.
Could you clarify if there are any additional steps required or if i might be missing something?
yarn sqlx-ts ./src
[WARN] Failed to read config file from the path: ".sqlxrc.json"
[ERROR] Unable to retrieve a database type, please check your configuration and try again
thread 'main' panicked at src/common/config.rs:219:9:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Example of my .env
DB_HOST=127.0.0.1
DB_NAME=backend
DB_PASS=
DB_USER=
DB_PORT=5432
DB_TYPE=postgres
hey, the error says it cannot read .sqlxrc.json file, are you sure .sqlxrc.json is present?
Yes, .sqlxrc.json exists. But if I don’t specify -c .sqlxrc.json, it doesn’t find it. If I do specify it, it complains about missing fields in .sqlxrc. The missing fields are exported as environment variables, and I can see them using the env command.
{
"generateTypes": {
"enabled": true,
"convertToCamelCaseColumnName": true
},
}
I believe this issue is now resolved in v0.22.0, thanks for your contribution!