Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/emulator/dataconnectEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@

export class DataConnectEmulator implements EmulatorInstance {
private emulatorClient: DataConnectEmulatorClient;
private usingExistingEmulator: boolean = false;

Check warning on line 70 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Type boolean trivially inferred from a boolean literal, remove type annotation
private postgresServer: PostgresServer | undefined;

constructor(private args: DataConnectEmulatorArgs) {
this.emulatorClient = new DataConnectEmulatorClient();

Check warning on line 74 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

'DataConnectEmulatorClient' was used before it was defined
}
private logger = EmulatorLogger.forEmulator(Emulators.DATACONNECT);

Expand Down Expand Up @@ -99,8 +99,8 @@
);
}
}
} catch (err: any) {

Check warning on line 102 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
this.logger.log("DEBUG", `'fdc build' failed with error: ${err.message}`);

Check warning on line 103 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 103 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
}
const env = await DataConnectEmulator.getEnv(this.args.account, this.args.extraEnv);
await start(
Expand Down Expand Up @@ -130,24 +130,24 @@
`FIREBASE_DATACONNECT_POSTGRESQL_STRING is set to ${clc.bold(connStr)} - using that instead of starting a new database`,
);
} else if (pgHost && pgPort) {
let dataDirectory = this.args.config.get("emulators.dataconnect.dataDir");

Check warning on line 133 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
if (dataDirectory) {
dataDirectory = this.args.config.path(dataDirectory);

Check warning on line 135 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `string`
}
const postgresDumpPath = this.args.importPath
? path.join(this.args.importPath, "postgres.tar.gz")
: undefined;
this.postgresServer = new PostgresServer({
dataDirectory,

Check warning on line 141 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
importPath: postgresDumpPath,
debug: this.args.debug,
});
const server = await this.postgresServer.createPGServer(pgHost, pgPort);
const connectableHost = connectableHostname(pgHost);
connStr = `postgres://${connectableHost}:${pgPort}/${dbId}?sslmode=disable`;
server.on("error", (err: any) => {

Check warning on line 148 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
if (err instanceof FirebaseError) {
this.logger.logLabeled("ERROR", "Data Connect", `${err}`);

Check warning on line 150 in src/emulator/dataconnectEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "FirebaseError" of template literal expression
} else {
this.logger.logLabeled(
"ERROR",
Expand Down Expand Up @@ -362,6 +362,7 @@
account,
EmulatorLogger.forEmulator(Emulators.DATACONNECT),
"dataconnect",
true,
);
return { ...process.env, ...extraEnv, ...credsEnv };
}
Expand Down
12 changes: 7 additions & 5 deletions src/emulator/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ export async function getCredentialsEnvironment(
account: Account | undefined,
logger: EmulatorLogger,
logLabel: string,
silent: boolean = false,
): Promise<Record<string, string>> {
// Provide default application credentials when appropriate
const credentialEnv: Record<string, string> = {};
if (await hasDefaultCredentials()) {
logger.logLabeled(
"WARN",
logLabel,
`Application Default Credentials detected. Non-emulated services will access production using these credentials. Be careful!`,
);
!silent &&
logger.logLabeled(
"WARN",
logLabel,
`Application Default Credentials detected. Non-emulated services will access production using these credentials. Be careful!`,
);
} else if (account) {
const defaultCredPath = await getCredentialPathAsync(account);
if (defaultCredPath) {
Expand Down
Loading