Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TILE_SERVER_ENDPOINT=https://tiles.streets.gl
TILES_ENDPOINT_TEMPLATE='https://tiles.streets.gl/vector/{z}/{x}/{y}'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.idea
build
.DS_Store
coverage
coverage
.env
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"d3": "^7.6.1",
"dagre": "^0.8.5",
"dagre-d3": "^0.6.4",
"dotenv": "^16.4.7",
"earcut": "^2.2.2",
"lerc": "^4.0.4",
"path-browserify": "^1.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/app/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ const Config = {
{url: 'https://overpass.openstreetmap.ru/cgi/interpreter', isEnabled: false},
{url: 'https://overpass.kumi.systems/api/interpreter', isEnabled: false}
],
TileServerEndpoint: 'https://tiles.streets.gl',
TileServerEndpoint: process.env.TILE_SERVER_ENDPOINT,
SlippyEndpointTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
TilesEndpointTemplate: 'https://tiles.streets.gl/vector/{z}/{x}/{y}'
TilesEndpointTemplate: process.env.TILES_ENDPOINT_TEMPLATE
};

export default Config;
12 changes: 12 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const dotenv = require('dotenv');
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
Expand All @@ -12,6 +13,12 @@ const COMMIT_SHA = childProcess.execSync('git rev-parse HEAD').toString().trim()
const COMMIT_BRANCH = childProcess.execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
const VERSION = require('./package.json').version;

const isProduction = process.env.NODE_ENV === 'production'

if (!isProduction) {
dotenv.config();
}

module.exports = (env, argv) => ([{
entry: './src/app/App.ts',
output: {
Expand Down Expand Up @@ -54,6 +61,11 @@ module.exports = (env, argv) => ([{
extensions: ['ts', 'tsx']
}),
new DefinePlugin({
'process.env': JSON.stringify(
argv.mode === 'production'
? process.env // Use system environment variables in production
: dotenv.config().parsed // Use .env variables in development
),
COMMIT_SHA: JSON.stringify(COMMIT_SHA),
COMMIT_BRANCH: JSON.stringify(COMMIT_BRANCH),
VERSION: JSON.stringify(VERSION)
Expand Down