Change env variables
RC_* to RINGCENTRAL_* APP_KEY and APP_SECRET repalced with CLIENT_ID and CLIENT_SECRET to reflect RingCentral's descriptions Change RC_SANDBOX to RINGCENTRAL_SERVER and changed its behaviour.
This commit is contained in:
parent
9a61396db6
commit
48a3e60623
15
README.md
15
README.md
@ -8,14 +8,15 @@
|
|||||||
# Required API endpoint/authentication variables
|
# Required API endpoint/authentication variables
|
||||||
SONAR_URL=https://instance.sonar.software/api/graphql
|
SONAR_URL=https://instance.sonar.software/api/graphql
|
||||||
SONAR_TOKEN=
|
SONAR_TOKEN=
|
||||||
RC_APP_KEY=
|
RINGCENTRAL_CLIENT_ID=
|
||||||
RC_APP_SECRET=
|
RINGCENTRAL_CLIENT_SECRET=
|
||||||
RC_LOGIN_USERNAME=
|
RINGCENTRAL_USERNAME=
|
||||||
RC_LOGIN_EXT=
|
RINGCENTRAL_EXTENSION=
|
||||||
RC_LOGIN_PASSWORD=
|
RINGCENTRAL_PASSWORD=
|
||||||
|
|
||||||
# Set to any value to enable use of RingCentral's sandbox API
|
# Set to 'sandbox' to use RingCentral's sandbox API
|
||||||
RC_SANDBOX=
|
# Any other value will result in using RingCentral's production API
|
||||||
|
RINGCENTRAL_SERVER=production
|
||||||
|
|
||||||
# The database to use
|
# The database to use
|
||||||
# valid options: pg, sqlite
|
# valid options: pg, sqlite
|
||||||
|
25
src/index.ts
25
src/index.ts
@ -9,11 +9,11 @@ function checkEnv() {
|
|||||||
[
|
[
|
||||||
"SONAR_URL",
|
"SONAR_URL",
|
||||||
"SONAR_TOKEN",
|
"SONAR_TOKEN",
|
||||||
"RC_APP_KEY",
|
"RINGCENTRAL_CLIENT_ID",
|
||||||
"RC_APP_SECRET",
|
"RINGCENTRAL_CLIENT_SECRET",
|
||||||
"RC_LOGIN_USERNAME",
|
"RINGCENTRAL_USERNAME",
|
||||||
"RC_LOGIN_EXT",
|
"RINGCENTRAL_EXTENSION",
|
||||||
"RC_LOGIN_PASSWORD",
|
"RINGCENTRAL_PASSWORD",
|
||||||
"EXTENSION_TICKET_GROUPS",
|
"EXTENSION_TICKET_GROUPS",
|
||||||
].forEach((env) => {
|
].forEach((env) => {
|
||||||
if (process.env[env] === undefined) {
|
if (process.env[env] === undefined) {
|
||||||
@ -65,16 +65,19 @@ async function initSonar() {
|
|||||||
|
|
||||||
async function initRingCentralSDK() {
|
async function initRingCentralSDK() {
|
||||||
const sdk = new SDK({
|
const sdk = new SDK({
|
||||||
server: SDK.server[process.env.RC_SANDBOX ? "sandbox" : "production"],
|
server:
|
||||||
clientId: process.env.RC_APP_KEY,
|
SDK.server[
|
||||||
clientSecret: process.env.RC_APP_SECRET,
|
process.env.RINGCENTRAL_SERVER === "sandbox" ? "sandbox" : "production"
|
||||||
|
],
|
||||||
|
clientId: process.env.RINGCENTRAL_CLIENT_ID,
|
||||||
|
clientSecret: process.env.RINGCENTRAL_CLIENT_SECRET,
|
||||||
});
|
});
|
||||||
|
|
||||||
const login = () =>
|
const login = () =>
|
||||||
sdk.login({
|
sdk.login({
|
||||||
username: process.env.RC_LOGIN_USERNAME,
|
username: process.env.RINGCENTRAL_USERNAME,
|
||||||
extension: process.env.RC_LOGIN_EXT,
|
extension: process.env.RINGCENTRAL_EXTENSION,
|
||||||
password: process.env.RC_LOGIN_PASSWORD,
|
password: process.env.RINGCENTRAL_PASSWORD,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
Loading…
Reference in New Issue
Block a user