Skip to content

Commit

Permalink
feat(server): add cors options for prd
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalovelo committed Sep 8, 2022
1 parent 3603716 commit 4ff0cce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/utils/sdk-service/sdk-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const NODE_URL =
export const COMPILER_URL =
import.meta.env.VITE_COMPILER_URL ?? 'http://localhost:3080';
export const IS_USING_LOCAL_NODE = !import.meta.env.VITE_NODE_URL.includes(
'testnet.aeternity.io'
'testnet'
);
const FAUCET_PUBLIC_ADDRESS = import.meta.env
.VITE_FAUCET_PUBLIC_ADDRESS as Encoded.AccountAddress;
Expand Down
6 changes: 5 additions & 1 deletion server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export const app = express();
const corsOptions = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'testnet'
? null
: {
origin: [/\.aeternity\.com\/?$/, /\.aepps\.com\/?$/],
origin: [
/\.aeternity\.com\/?$/,
/\.aepps\.com\/?$/,
/.*\.aepps\.com\/rock-paper-scissors\/?$/,
],
};

app.use(cors(corsOptions));
Expand Down
4 changes: 2 additions & 2 deletions server/src/env/.env.testnet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const NODE_URL = "http://testnet.prd.aepps.com:3013 ";
export const WS_URL = "http://testnet.prd.aepps.com:3014 ";
export const NODE_URL = "http://testnet.prd.aepps.com:3013";
export const WS_URL = "http://testnet.prd.aepps.com:3014";
export const COMPILER_URL = "https://compiler.aepps.com";
export const FAUCET_PUBLIC_ADDRESS =
"ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688";
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/sdk/sdk.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const IGNORE_NODE_VERSION = env[ENVIRONMENT]?.IGNORE_VERSION === 'true'
?? process.env.IGNORE_VERSION === 'true';
export const FAUCET_PUBLIC_ADDRESS = env[ENVIRONMENT]?.FAUCET_PUBLIC_ADDRESS
?? (process.env.FAUCET_PUBLIC_ADDRESS as Encoded.AccountAddress);
export const IS_USING_LOCAL_NODE = !NODE_URL?.includes('testnet.aeternity.io');
export const IS_USING_LOCAL_NODE = !NODE_URL?.includes('testnet');
// ! LOCAL NODE USAGE ONLY
const FAUCET_SECRET_KEY = (ENVIRONMENT === 'development' && env[ENVIRONMENT]?.FAUCET_SECRET_KEY)
|| process.env.FAUCET_SECRET_KEY;
Expand Down

0 comments on commit 4ff0cce

Please sign in to comment.