Reputation: 37
I am working with typeorm and Oracle with typescript, but I have the following problem when I want to connect. Basically I want to use externalAuth but it tells me that the variable is read only, how can I solve it??
Cannot assign to 'externalAuth' because it is a read-only
import { DataSource } from "typeorm"
import { Empleado } from "./entity/Empleado"
import * as oracledb from "oracledb";
oracledb.externalAuth = true;
oracledb.initOracleClient({ libDir: 'C:\\instantclient_19_12' });
export const AppDataSource = new DataSource({
type: "oracle",
connectString: "xxxxx",
database: "xxxx",
synchronize: false,
logging: true,
entities: [Empleado],
migrations: [],
subscribers: [],
})```
Upvotes: 0
Views: 1808
Reputation: 10506
From a quick test with the TypeORM sample app, setting externalAuth
using the extra
attribute in the project's ormconfig.json
file like this seems to pass through the correct settings to node-oracledb:
{
"type": "oracle",
"connectString": "localhost/orclpdb1",
"synchronize": true,
"logging": false,
"extra" : {
"externalAuth": true
},
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
}
}
Upvotes: 1