Skip to content

Commit

Permalink
Allow providing custom network during build time
Browse files Browse the repository at this point in the history
  • Loading branch information
dincho committed Nov 28, 2022
1 parent 1c5b0e3 commit ae1aca4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
FROM node:14.7-alpine as aepp-aepp-base-build
WORKDIR /app
RUN apk add make gcc g++ python git
COPY . .

ADD package*.json ./
RUN npm install

COPY . .

ARG VUE_APP_NETWORK_NAME
ARG VUE_APP_NODE_URL
ARG VUE_APP_MDW_URL
ARG VUE_APP_EXPLORER_URL
ARG VUE_APP_COMPILER_URL

RUN npm run build

FROM nginx:1.13.7-alpine
FROM nginx:1.13.9-alpine
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=aepp-aepp-base-build /app/dist /usr/share/nginx/html
24 changes: 19 additions & 5 deletions src/lib/networksRegistry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const defaultNetwork = {
const mainNetwork = {
name: 'Iris-net',
url: 'https://mainnet.aeternity.io',
middlewareUrl: 'https://mainnet.aeternity.io/mdw',
Expand All @@ -14,10 +14,24 @@ const testNetwork = {
compilerUrl: 'https://compiler.aepps.com',
};

export default Object.freeze((process.env.NODE_ENV === 'production' ? [
defaultNetwork,
let networks = process.env.NODE_ENV === 'production' ? [
mainNetwork,
testNetwork,
] : [
testNetwork,
defaultNetwork,
]).map(Object.freeze));
mainNetwork,
];

export const defaultNetwork = process.env.VUE_APP_NETWORK_NAME ? {
name: process.env.VUE_APP_NETWORK_NAME,
url: process.env.VUE_APP_NODE_URL,
middlewareUrl: process.env.VUE_APP_MDW_URL,
explorerUrl: process.env.VUE_APP_EXPLORER_URL,
compilerUrl: process.env.VUE_APP_COMPILER_URL,
} : mainNetwork;

if (process.env.VUE_APP_NETWORK_NAME) {
networks = [defaultNetwork];
}

export default Object.freeze(networks.map(Object.freeze));

0 comments on commit ae1aca4

Please sign in to comment.