Skip to content

Commit

Permalink
chore(envs): Split RW and GFW API's keys to make it more flexible
Browse files Browse the repository at this point in the history
Now we can set each API separatedly, making it easier to test different environments at once
  • Loading branch information
willian-viana committed Nov 15, 2024
1 parent ed569a8 commit c3e97ad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pages/api/metadata/[...params].js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GFW_METADATA_API, GFW_STAGING_METADATA_API } from 'utils/apis';
import axios from 'axios';

const ENVIRONMENT = process.env.NEXT_PUBLIC_FEATURE_ENV;
const ENVIRONMENT = process.env.NEXT_PUBLIC_RW_FEATURE_ENV;
const GFW_METADATA_API_URL =
ENVIRONMENT === 'staging' ? GFW_STAGING_METADATA_API : GFW_METADATA_API;

Expand Down
2 changes: 1 addition & 1 deletion providers/datasets-provider/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const setDatasets = createAction('setDatasets');
export const setDatasetsWithMetadata = createAction('setDatasetsWithMetadata');

const handleFeatureEnvLock = (env) => {
const currEnv = process.env.NEXT_PUBLIC_FEATURE_ENV;
const currEnv = process.env.NEXT_PUBLIC_RW_FEATURE_ENV;
const MIXED_ENV = 'preproduction-staging';
if (env === MIXED_ENV && currEnv !== 'production') {
return true;
Expand Down
2 changes: 1 addition & 1 deletion services/datasets.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { rwRequest, dataRequest } from 'utils/request';

const environmentString = () => {
const env = process.env.NEXT_PUBLIC_FEATURE_ENV;
const env = process.env.NEXT_PUBLIC_RW_FEATURE_ENV;
let envString = 'production';
if (env === 'preproduction') {
envString += ',preproduction';
Expand Down
4 changes: 3 additions & 1 deletion services/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import request from 'utils/request';
import { GFW_API, GFW_STAGING_API } from 'utils/apis';

const GFW_API_URL =
process.env.NEXT_PUBLIC_FEATURE_ENV === 'staging' ? GFW_STAGING_API : GFW_API;
process.env.NEXT_PUBLIC_RW_FEATURE_ENV === 'staging'
? GFW_STAGING_API
: GFW_API;

const QUERIES = {
ogrConvert: '/v2/ogr/convert',
Expand Down

0 comments on commit c3e97ad

Please sign in to comment.