mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Merge branch 'master' of github.com:Re-Ignited-Development/new-phone-who-dis into bug/mysql-connection-strings
This commit is contained in:
commit
11f0302fea
4 files changed
+157
-204
No files matched your search
+69
-112
@@ -90,36 +90,21 @@ async function loadAnimDict(dict: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function phoneOpenAnim() {
|
async function phoneOpenAnim() { //Phone Open Animation
|
||||||
//Phone Open Animation
|
console.log("phoneOpenAnim") //Left for testing purposes.
|
||||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
const flag = 50 //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||||
deletePhone(); //Deleting before creating a new phone where itll be deleted again.
|
deletePhone() //Deleting before creating a new phone where itll be deleted again.
|
||||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) { //-- true refers to at get in.
|
||||||
//-- true refers to at get in.
|
const dict = 'anim@cellphone@in_car@ps'
|
||||||
const dict = "anim@cellphone@in_car@ps";
|
|
||||||
const kek = "pepein";
|
|
||||||
|
|
||||||
ClearPedTasks(GetPlayerPed(-1));
|
ClearPedTasks(GetPlayerPed(-1))
|
||||||
await loadAnimDict(dict);
|
await loadAnimDict(dict)
|
||||||
TaskPlayAnim(
|
TaskPlayAnim(GetPlayerPed(-1), dict, 'cellphone_text_in', 8.0, -1, -1, flag, 0, false, false, false)
|
||||||
GetPlayerPed(-1),
|
await Delay(300) //Gives time for animation starts before creating the phone
|
||||||
dict,
|
await newPhoneProp() //Creates the phone and attaches it.
|
||||||
"cellphone_text_in",
|
}
|
||||||
8.0,
|
else { //While not in a vehicle it will use this dict.
|
||||||
-1,
|
const dict = 'cellphone@'
|
||||||
-1,
|
|
||||||
flag,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
await Delay(300); //Gives time for animation starts before creating the phone
|
|
||||||
await newPhoneProp(); //Creates the phone and attaches it.
|
|
||||||
} else {
|
|
||||||
//While not in a vehicle it will use this dict.
|
|
||||||
const dict = "cellphone@";
|
|
||||||
const kek = "pepeout";
|
|
||||||
|
|
||||||
ClearPedTasks(GetPlayerPed(-1));
|
ClearPedTasks(GetPlayerPed(-1));
|
||||||
await loadAnimDict(dict);
|
await loadAnimDict(dict);
|
||||||
@@ -141,59 +126,32 @@ async function phoneOpenAnim() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function phoneCloseAnim() {
|
async function phoneCloseAnim() { //Phone Close Animation
|
||||||
//Phone Close Animation
|
console.log("phoneCloseAnim") //Left for testing purposes.
|
||||||
const flag = 50; //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
const flag = 50 //https://runtime.fivem.net/doc/natives/?_0xEA47FE3719165B94
|
||||||
const anim = "cellphone_text_out";
|
const anim = 'cellphone_text_out'
|
||||||
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) {
|
if (IsPedInAnyVehicle(GetPlayerPed(-1), true)) { //true refers to at get in.
|
||||||
//true refers to at get in.
|
const dict = 'anim@cellphone@in_car@ps'
|
||||||
const dict = "anim@cellphone@in_car@ps";
|
|
||||||
const kek = "pepein";
|
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0) //Stop the pull out animation
|
||||||
|
deletePhone() //Deletes the prop early incase they get out of the vehicle.
|
||||||
|
await Delay(250) //lets it get to a certain point
|
||||||
|
loadAnimDict(dict) //loads the new animation
|
||||||
|
TaskPlayAnim(GetPlayerPed(-1), dict, anim, 8.0, -1, -1, flag, 0, false, false, false) //puts phone into pocket
|
||||||
|
await Delay(200) //waits until the phone is in the pocket
|
||||||
|
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0) //clears the animation
|
||||||
|
}
|
||||||
|
else { //While not in a vehicle it will use this dict.
|
||||||
|
const dict = 'cellphone@'
|
||||||
|
|
||||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
StopAnimTask(GetPlayerPed(-1), dict, 'cellphone_text_in', 1.0) //Stop the pull out animation
|
||||||
deletePhone(); //Deletes the prop early incase they get out of the vehicle.
|
await Delay(100) //lets it get to a certain point
|
||||||
await Delay(250); //lets it get to a certain point
|
loadAnimDict(dict) //loads the new animation
|
||||||
loadAnimDict(dict); //loads the new animation
|
TaskPlayAnim(GetPlayerPed(-1), dict, anim, 8.0, -1, -1, flag, 0, false, false, false) //puts phone into pocket
|
||||||
TaskPlayAnim(
|
await Delay(200) //waits until the phone is in the pocket
|
||||||
GetPlayerPed(-1),
|
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0) //clears the animation
|
||||||
dict,
|
deletePhone() //Deletes the prop.
|
||||||
anim,
|
}
|
||||||
8.0,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
flag,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
); //puts phone into pocket
|
|
||||||
await Delay(200); //waits until the phone is in the pocket
|
|
||||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0); //clears the animation
|
|
||||||
} else {
|
|
||||||
//While not in a vehicle it will use this dict.
|
|
||||||
const dict = "cellphone@";
|
|
||||||
const kek = "pepeout";
|
|
||||||
|
|
||||||
StopAnimTask(GetPlayerPed(-1), dict, "cellphone_text_in", 1.0); //Stop the pull out animation
|
|
||||||
await Delay(100); //lets it get to a certain point
|
|
||||||
loadAnimDict(dict); //loads the new animation
|
|
||||||
TaskPlayAnim(
|
|
||||||
GetPlayerPed(-1),
|
|
||||||
dict,
|
|
||||||
anim,
|
|
||||||
8.0,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
flag,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
); //puts phone into pocket
|
|
||||||
await Delay(200); //waits until the phone is in the pocket
|
|
||||||
StopAnimTask(GetPlayerPed(-1), dict, anim, 1.0); //clears the animation
|
|
||||||
deletePhone(); //Deletes the prop.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function carryingPhone(cb: any) {
|
async function carryingPhone(cb: any) {
|
||||||
@@ -230,12 +188,12 @@ setTick(() => {
|
|||||||
|
|
||||||
async function Phone() {
|
async function Phone() {
|
||||||
if (config.PhoneAsItem) {
|
if (config.PhoneAsItem) {
|
||||||
|
console.log("CONFIG ON")
|
||||||
carryingPhone(async (carryingPhone: any) => {
|
carryingPhone(async (carryingPhone: any) => {
|
||||||
if (carryingPhone) {
|
if (carryingPhone) {
|
||||||
if (!isPhoneOpen) {
|
if (!isPhoneOpen) {
|
||||||
isPhoneOpen = true;
|
isPhoneOpen = true
|
||||||
await phoneOpenAnim();
|
await phoneOpenAnim()
|
||||||
console.log("phone is now open"); //Left for testing purposes.
|
|
||||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||||
emitNet("phone:getCredentials"); // Gets the credentials. Will eventually most likely only get the phone number and name, idk.
|
emitNet("phone:getCredentials"); // Gets the credentials. Will eventually most likely only get the phone number and name, idk.
|
||||||
SetCursorLocation(0.936, 0.922); //Experimental
|
SetCursorLocation(0.936, 0.922); //Experimental
|
||||||
@@ -246,32 +204,32 @@ async function Phone() {
|
|||||||
method: "setVisibility",
|
method: "setVisibility",
|
||||||
data: true,
|
data: true,
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
sendPhoneConfig();
|
sendPhoneConfig()
|
||||||
SetNuiFocus(true, true);
|
SetNuiFocus(true, true)
|
||||||
} else {
|
}
|
||||||
isPhoneOpen = false;
|
else {
|
||||||
console.log("phone is now closed"); //Left for testing purposes.
|
isPhoneOpen = false
|
||||||
SendNuiMessage(
|
await phoneCloseAnim()
|
||||||
//Hides phone
|
SendNuiMessage( //Hides phone
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: "PHONE",
|
app: "PHONE",
|
||||||
method: "setVisibility",
|
method: "setVisibility",
|
||||||
data: false,
|
data: false,
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
SetNuiFocus(false, false);
|
SetNuiFocus(false, false)
|
||||||
phoneCloseAnim();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
noPhone();
|
noPhone();
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} else if (!config.PhoneAsItem) {
|
}
|
||||||
if (!isPhoneOpen) {
|
else if (!config.PhoneAsItem) {
|
||||||
isPhoneOpen = true;
|
console.log("CONFIG OFF")
|
||||||
await phoneOpenAnim();
|
if (!isPhoneOpen) {
|
||||||
console.log("phone is now open"); //Left for testing purposes.
|
isPhoneOpen = true
|
||||||
|
await phoneOpenAnim()
|
||||||
emitNet(events.CONTACTS_GET_CONTACTS);
|
emitNet(events.CONTACTS_GET_CONTACTS);
|
||||||
emitNet("phone:getCredentials");
|
emitNet("phone:getCredentials");
|
||||||
SetCursorLocation(0.936, 0.922); //Experimental
|
SetCursorLocation(0.936, 0.922); //Experimental
|
||||||
@@ -282,22 +240,21 @@ async function Phone() {
|
|||||||
method: "setVisibility",
|
method: "setVisibility",
|
||||||
data: true,
|
data: true,
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
sendPhoneConfig();
|
sendPhoneConfig()
|
||||||
SetNuiFocus(true, true);
|
SetNuiFocus(true, true)
|
||||||
} else {
|
}
|
||||||
isPhoneOpen = false;
|
else {
|
||||||
console.log("phone is now closed"); //Left for testing purposes.
|
isPhoneOpen = false
|
||||||
SendNuiMessage(
|
await phoneCloseAnim()
|
||||||
//Hides phone
|
SendNuiMessage( //Hides phone
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
app: "PHONE",
|
app: "PHONE",
|
||||||
method: "setVisibility",
|
method: "setVisibility",
|
||||||
data: false,
|
data: false,
|
||||||
})
|
})
|
||||||
);
|
)
|
||||||
SetNuiFocus(false, false);
|
SetNuiFocus(false, false)
|
||||||
await phoneCloseAnim();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import mysql from "mysql2/promise";
|
import mysql from "mysql2/promise";
|
||||||
import { ConnectionStringParser } from "connection-string-parser";
|
import { ConnectionStringParser } from "connection-string-parser";
|
||||||
import {
|
import {
|
||||||
CONNECTION_STRING,
|
CONNECTION_STRING,
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
parseSemiColonFormat,
|
parseSemiColonFormat,
|
||||||
getServerHost,
|
getServerHost,
|
||||||
getUserId,
|
getUserId,
|
||||||
getPassword,
|
getPassword,
|
||||||
} from './db_utils';
|
} from "./db_utils";
|
||||||
|
|
||||||
// we require set mysql_connection_string to be set in the config
|
// we require set mysql_connection_string to be set in the config
|
||||||
const mysqlConnectionString = GetConvar(CONNECTION_STRING, null);
|
const mysqlConnectionString = GetConvar(CONNECTION_STRING, null);
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
import * as db from "./db_utils";
|
import * as db from "./db_utils";
|
||||||
|
|
||||||
const t = 'test value';
|
const t = "test value";
|
||||||
|
|
||||||
describe("parseSemiColonFormat", () => {
|
describe("parseSemiColonFormat", () => {
|
||||||
|
|
||||||
it("Raises a error with invalid string", () => {
|
it("Raises a error with invalid string", () => {
|
||||||
expect(() => db.parseSemiColonFormat("no_variables_here")).toThrowError();
|
expect(() => db.parseSemiColonFormat("no_variables_here")).toThrowError();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it("Correctly parses configuration options", () => {
|
it("Correctly parses configuration options", () => {
|
||||||
const test = 'server=127.0.0.1;database=es_extended;userid=user;password=pass';
|
const test =
|
||||||
|
"server=127.0.0.1;database=es_extended;userid=user;password=pass";
|
||||||
const result = db.parseSemiColonFormat(test);
|
const result = db.parseSemiColonFormat(test);
|
||||||
|
|
||||||
expect(result.server).toEqual('127.0.0.1');
|
expect(result.server).toEqual("127.0.0.1");
|
||||||
expect(result.database).toEqual('es_extended');
|
expect(result.database).toEqual("es_extended");
|
||||||
expect(result.userid).toEqual('user');
|
expect(result.userid).toEqual("user");
|
||||||
expect(result.password).toEqual('pass');
|
expect(result.password).toEqual("pass");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -24,27 +23,27 @@ describe("getServerHost", () => {
|
|||||||
it("returns default", () => {
|
it("returns default", () => {
|
||||||
expect(db.getServerHost({})).toEqual(db.DEFAULT_HOST);
|
expect(db.getServerHost({})).toEqual(db.DEFAULT_HOST);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns host", () => {
|
it("Correctly returns host", () => {
|
||||||
expect(db.getServerHost({ host: t })).toEqual(t);
|
expect(db.getServerHost({ host: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns server", () => {
|
it("Correctly returns server", () => {
|
||||||
expect(db.getServerHost({ server: t })).toEqual(t);
|
expect(db.getServerHost({ server: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns data source", () => {
|
it("Correctly returns data source", () => {
|
||||||
expect(db.getServerHost({ 'data source': t })).toEqual(t);
|
expect(db.getServerHost({ "data source": t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns datasource", () => {
|
it("Correctly returns datasource", () => {
|
||||||
expect(db.getServerHost({ datasource: t })).toEqual(t);
|
expect(db.getServerHost({ datasource: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns addr", () => {
|
it("Correctly returns addr", () => {
|
||||||
expect(db.getServerHost({ addr: t })).toEqual(t);
|
expect(db.getServerHost({ addr: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns address", () => {
|
it("Correctly returns address", () => {
|
||||||
expect(db.getServerHost({ address: t })).toEqual(t);
|
expect(db.getServerHost({ address: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
@@ -54,43 +53,42 @@ describe("getUserId", () => {
|
|||||||
it("returns default", () => {
|
it("returns default", () => {
|
||||||
expect(db.getUserId({})).toEqual(db.DEFAULT_USER);
|
expect(db.getUserId({})).toEqual(db.DEFAULT_USER);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns user", () => {
|
it("Correctly returns user", () => {
|
||||||
expect(db.getUserId({ user: t })).toEqual(t);
|
expect(db.getUserId({ user: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns user id", () => {
|
it("Correctly returns user id", () => {
|
||||||
expect(db.getUserId({ 'user id': t })).toEqual(t);
|
expect(db.getUserId({ "user id": t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns userid", () => {
|
it("Correctly returns userid", () => {
|
||||||
expect(db.getUserId({ userid: t })).toEqual(t);
|
expect(db.getUserId({ userid: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns user name", () => {
|
it("Correctly returns user name", () => {
|
||||||
expect(db.getUserId({ 'user name': t })).toEqual(t);
|
expect(db.getUserId({ "user name": t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns username", () => {
|
it("Correctly returns username", () => {
|
||||||
expect(db.getUserId({ username: t })).toEqual(t);
|
expect(db.getUserId({ username: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns uid", () => {
|
it("Correctly returns uid", () => {
|
||||||
expect(db.getUserId({ uid: t })).toEqual(t);
|
expect(db.getUserId({ uid: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("getPassword", () => {
|
describe("getPassword", () => {
|
||||||
it("returns default", () => {
|
it("returns default", () => {
|
||||||
expect(() => db.getPassword({})).toThrowError();
|
expect(() => db.getPassword({})).toThrowError();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns password", () => {
|
it("Correctly returns password", () => {
|
||||||
expect(db.getPassword({ password: t })).toEqual(t);
|
expect(db.getPassword({ password: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Correctly returns pwd", () => {
|
it("Correctly returns pwd", () => {
|
||||||
expect(db.getPassword({ pwd: t })).toEqual(t);
|
expect(db.getPassword({ pwd: t })).toEqual(t);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -3,71 +3,69 @@ export const DEFAULT_PORT = 3306;
|
|||||||
export const DEFAULT_HOST = "localhost";
|
export const DEFAULT_HOST = "localhost";
|
||||||
export const DEFAULT_USER = "root";
|
export const DEFAULT_USER = "root";
|
||||||
|
|
||||||
|
|
||||||
interface Map {
|
interface Map {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse the connection string from the format server=127.0.0.1;database=es_extended;userid=user;password=pass
|
* parse the connection string from the format server=127.0.0.1;database=es_extended;userid=user;password=pass
|
||||||
* @param connectionString - mysql_connection_string value
|
* @param connectionString - mysql_connection_string value
|
||||||
*/
|
*/
|
||||||
export function parseSemiColonFormat(connectionString: string): Map {
|
export function parseSemiColonFormat(connectionString: string): Map {
|
||||||
const parts = connectionString.split(";");
|
const parts = connectionString.split(";");
|
||||||
if (parts.length === 1) {
|
if (parts.length === 1) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Connection string ${connectionString} is in the incorrect format.`
|
`Connection string ${connectionString} is in the incorrect format.`
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parts.reduce((connectionInfo: Map, part) => {
|
|
||||||
const [key, value] = part.split("=");
|
|
||||||
connectionInfo[key] = value;
|
|
||||||
return connectionInfo;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* allowed variable names: host | server | data source | datasource | addr | address
|
|
||||||
* @param config - database config variables parsed from mysql_connection_string
|
|
||||||
*/
|
|
||||||
export function getServerHost(config: Map): string {
|
|
||||||
return (
|
|
||||||
config.host ||
|
|
||||||
config.server ||
|
|
||||||
config["data source"] ||
|
|
||||||
config.datasource ||
|
|
||||||
config.addr ||
|
|
||||||
config.address ||
|
|
||||||
DEFAULT_HOST
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return parts.reduce((connectionInfo: Map, part) => {
|
||||||
* allowed variable names: user | user id | userid | user name | username | uid
|
const [key, value] = part.split("=");
|
||||||
* @param config - database config variables parsed from mysql_connection_string
|
connectionInfo[key] = value;
|
||||||
*/
|
return connectionInfo;
|
||||||
export function getUserId(config: Map): string {
|
}, {});
|
||||||
return (
|
}
|
||||||
config.user ||
|
|
||||||
config["user id"] ||
|
/**
|
||||||
config.userid ||
|
* allowed variable names: host | server | data source | datasource | addr | address
|
||||||
config["user name"] ||
|
* @param config - database config variables parsed from mysql_connection_string
|
||||||
config.username ||
|
*/
|
||||||
config.uid ||
|
export function getServerHost(config: Map): string {
|
||||||
DEFAULT_USER
|
return (
|
||||||
);
|
config.host ||
|
||||||
|
config.server ||
|
||||||
|
config["data source"] ||
|
||||||
|
config.datasource ||
|
||||||
|
config.addr ||
|
||||||
|
config.address ||
|
||||||
|
DEFAULT_HOST
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allowed variable names: user | user id | userid | user name | username | uid
|
||||||
|
* @param config - database config variables parsed from mysql_connection_string
|
||||||
|
*/
|
||||||
|
export function getUserId(config: Map): string {
|
||||||
|
return (
|
||||||
|
config.user ||
|
||||||
|
config["user id"] ||
|
||||||
|
config.userid ||
|
||||||
|
config["user name"] ||
|
||||||
|
config.username ||
|
||||||
|
config.uid ||
|
||||||
|
DEFAULT_USER
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* allowed variable names: password | pwd
|
||||||
|
* @param config - database config variables parsed from mysql_connection_string
|
||||||
|
*/
|
||||||
|
export function getPassword(config: Map): string {
|
||||||
|
const password = config.password || config.pwd;
|
||||||
|
if (!password) {
|
||||||
|
throw new Error("Password is a required field");
|
||||||
}
|
}
|
||||||
|
return password;
|
||||||
/**
|
}
|
||||||
* allowed variable names: password | pwd
|
|
||||||
* @param config - database config variables parsed from mysql_connection_string
|
|
||||||
*/
|
|
||||||
export function getPassword(config: Map): string {
|
|
||||||
const password = config.password || config.pwd;
|
|
||||||
if (!password) {
|
|
||||||
throw new Error("Password is a required field");
|
|
||||||
}
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user