Skip to content

Commit

Permalink
Revert currentRegion name
Browse files Browse the repository at this point in the history
  • Loading branch information
rddimon committed May 4, 2023
1 parent 773cb37 commit 87d804b
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class Globals {
public static options: ServerlessOptions;
public static v3Utils: ServerlessUtils;

public static nodeRegion: string;
public static currentRegion: string;
public static credentials: any;

public static defaultRegion = "us-east-1";
Expand Down Expand Up @@ -67,7 +67,7 @@ export default class Globals {

public static getRegion() {
const slsRegion = Globals.options.region || Globals.serverless.service.provider.region;
return slsRegion || Globals.nodeRegion || Globals.defaultRegion;
return slsRegion || Globals.currentRegion || Globals.defaultRegion;
}

public static async getProfileCreds(profile: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ServerlessCustomDomain {
*/
public async initAWSRegion(): Promise<void> {
try {
Globals.nodeRegion = await loadConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)();
Globals.currentRegion = await loadConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS)();
} catch (err) {
Logging.logInfo("Node region was not found.");
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/acm-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("ACM Wrapper checks", () => {
it("Initialization regional", async () => {
const acmWrapper = new ACMWrapper(null, Globals.endpointTypes.regional);
const actualResult = await acmWrapper.acm.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
});

it("getCertArn by certificate name", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/api-gateway-v1-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("API Gateway V1 wrapper checks", () => {
it("Initialization", async () => {
const apiGatewayV1Wrapper = new APIGatewayV1Wrapper();
const actualResult = await apiGatewayV1Wrapper.apiGateway.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
});

describe("Custom domain", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/api-gateway-v2-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("API Gateway V2 wrapper checks", () => {
it("Initialization", async () => {
const apiGatewayV2Wrapper = new APIGatewayV2Wrapper();
const actualResult = await apiGatewayV2Wrapper.apiGateway.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
});

describe("Custom domain", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/cloud-formation-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Cloud Formation wrapper checks", () => {
it("Initialization", async () => {
const cloudFormationWrapper = new CloudFormationWrapper();
const actualResult = await cloudFormationWrapper.cloudFormation.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
expect(cloudFormationWrapper.stackName).to.equal(Globals.serverless.service.provider.stackName);
});

Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/route53-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("Route53 wrapper checks", () => {
it("Initialization", async () => {
const route53Wrapper = new Route53Wrapper();
const actualResult = await route53Wrapper.route53.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
});

it("Initialization profile", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/aws/s3-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("S3 wrapper checks", () => {
it("Initialization", async () => {
const s3Wrapper = new S3Wrapper();
const actualResult = await s3Wrapper.s3.config.region();
expect(actualResult).to.equal(Globals.nodeRegion);
expect(actualResult).to.equal(Globals.currentRegion);
});

it("Assert TlS cert object exists", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const getV3Utils = () => {
}
}

Globals.nodeRegion = "test_region";
Globals.currentRegion = "test_region";
Globals.options = {
stage: "test"
};
Expand Down

0 comments on commit 87d804b

Please sign in to comment.