mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 06:08:10 +00:00
passing configuration through webpack
This commit is contained in:
8
declaration.d.ts
vendored
8
declaration.d.ts
vendored
@@ -1 +1,9 @@
|
|||||||
declare module "*.scss";
|
declare module "*.scss";
|
||||||
|
declare var __CONFIG__: SettingType;
|
||||||
|
|
||||||
|
type SettingType = {
|
||||||
|
apiUrl: string;
|
||||||
|
apiVersion: string;
|
||||||
|
ssl: string;
|
||||||
|
appName: string;
|
||||||
|
};
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class AppMenuElement extends BaseComponentElement {
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div data-target="app-menu.sidebar">
|
<div data-target="app-menu.sidebar">
|
||||||
${menuHeader("Wallets")} ${regularMenu("/", "Home")}
|
${menuHeader(__CONFIG__.appName)} ${regularMenu("/", "Home")}
|
||||||
${authMenu("/history", "Transaction History")}
|
${authMenu("/history", "Transaction History")}
|
||||||
${authMenu(
|
${authMenu(
|
||||||
"/wallet/all",
|
"/wallet/all",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"apiUrl": "main-wallet--dtnyc2vcdgu2re9j-gtw.qovery.io",
|
"apiUrl": "localhost:4000",
|
||||||
"apiVersion": "v1",
|
"apiVersion": "v1",
|
||||||
"ssl": true
|
"ssl": false,
|
||||||
|
"appName": "Wallets"
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
import settings from "configs/development/app-settings.json";
|
|
||||||
|
|
||||||
class HttpClient {
|
class HttpClient {
|
||||||
private url: string;
|
private url: string;
|
||||||
constructor() {
|
constructor() {
|
||||||
this.url = `${settings.ssl ? "https" : "http"}://${settings.apiUrl}/${
|
this.url = `${__CONFIG__.ssl ? "https" : "http"}://${
|
||||||
settings.apiVersion
|
__CONFIG__.apiUrl
|
||||||
}`;
|
}/${__CONFIG__.apiVersion}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
post(url: string, data: Object, headersParam: HeadersInit): Promise<any> {
|
post(url: string, data: Object, headersParam: HeadersInit): Promise<any> {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const settings = require("./src/configs/development/app-settings.json");
|
||||||
|
const { DefinePlugin } = require('webpack');
|
||||||
|
|
||||||
const alias = {
|
const alias = {
|
||||||
common: path.resolve(__dirname, '/common'),
|
common: path.resolve(__dirname, '/common'),
|
||||||
@@ -83,6 +85,9 @@ module.exports = {
|
|||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: './src/index.html'
|
template: './src/index.html'
|
||||||
}),
|
}),
|
||||||
|
new DefinePlugin({
|
||||||
|
__CONFIG__: JSON.stringify(settings)
|
||||||
|
})
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.ts'],
|
extensions: ['.js', '.ts'],
|
||||||
|
|||||||
Reference in New Issue
Block a user