diff --git a/keyserver/Dockerfile b/keyserver/Dockerfile --- a/keyserver/Dockerfile +++ b/keyserver/Dockerfile @@ -20,6 +20,7 @@ ARG HOST_UID ARG HOST_GID +ARG COMM_ALCHEMY_KEY USER root RUN \ diff --git a/keyserver/docker-compose.yml b/keyserver/docker-compose.yml --- a/keyserver/docker-compose.yml +++ b/keyserver/docker-compose.yml @@ -7,6 +7,7 @@ args: - HOST_UID=${HOST_UID} - HOST_GID=${HOST_GID} + - COMM_ALCHEMY_KEY=${COMM_ALCHEMY_KEY} image: commapp/node-keyserver:1.0 restart: always ports: diff --git a/landing/.eslintrc.json b/landing/.eslintrc.json --- a/landing/.eslintrc.json +++ b/landing/.eslintrc.json @@ -1,5 +1,8 @@ { "env": { "browser": true + }, + "globals": { + "process": true } } diff --git a/landing/siwe.react.js b/landing/siwe.react.js --- a/landing/siwe.react.js +++ b/landing/siwe.react.js @@ -21,6 +21,7 @@ createClient, WagmiConfig, } from 'wagmi'; +import { alchemyProvider } from 'wagmi/providers/alchemy'; import { publicProvider } from 'wagmi/providers/public'; import type { SIWEWebViewMessage } from 'lib/types/siwe-types'; @@ -29,10 +30,13 @@ import { SIWENonceContext } from './siwe-nonce-context.js'; import css from './siwe.css'; -// details can be found https://wagmi.sh/docs/providers/configuring-chains +// details can be found https://0.6.x.wagmi.sh/docs/providers/configuring-chains +const availableProviders = process.env.COMM_ALCHEMY_KEY + ? [alchemyProvider({ apiKey: process.env.COMM_ALCHEMY_KEY })] + : [publicProvider()]; const { chains, provider } = configureChains( [chain.mainnet], - [publicProvider()], + availableProviders, ); const { connectors } = getDefaultWallets({ diff --git a/landing/webpack.config.cjs b/landing/webpack.config.cjs --- a/landing/webpack.config.cjs +++ b/landing/webpack.config.cjs @@ -1,5 +1,6 @@ const AssetsPlugin = require('assets-webpack-plugin'); const path = require('path'); +const webpack = require('webpack'); const { createProdBrowserConfig, @@ -65,18 +66,39 @@ }, }; +const alchemyKey = process.env.COMM_ALCHEMY_KEY; + module.exports = function (env) { - const browserConfig = + const rawBrowserConfig = env === 'prod' ? createProdBrowserConfig(baseProdBrowserConfig, babelConfig) : createDevBrowserConfig(baseDevBrowserConfig, babelConfig); - const nodeConfig = createNodeServerRenderingConfig( + const browserConfig = { + ...rawBrowserConfig, + plugins: [ + ...rawBrowserConfig.plugins, + new webpack.DefinePlugin({ + 'process.env': { + COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey), + }, + }), + ], + }; + const baseNodeConfig = createNodeServerRenderingConfig( baseNodeServerRenderingConfig, babelConfig, ); - const nodeServerRenderingConfig = { - ...nodeConfig, + const nodeConfig = { + ...baseNodeConfig, mode: env === 'prod' ? 'production' : 'development', + plugins: [ + ...baseNodeConfig.plugins, + new webpack.DefinePlugin({ + 'process.env': { + COMM_ALCHEMY_KEY: JSON.stringify(alchemyKey), + }, + }), + ], }; - return [browserConfig, nodeServerRenderingConfig]; + return [browserConfig, nodeConfig]; };