removed custom environment files and fixed config build

This commit is contained in:
lotte
2020-03-27 09:10:32 +01:00
parent e53727248d
commit 1b7fdfc59c
7 changed files with 15 additions and 16 deletions

View File

@@ -7,7 +7,6 @@
"config:prod": "ts-node --project ./tsconfig.ts-node.json scripts/set-env.ts --prod",
"config:test": "ts-node --project ./tsconfig.ts-node.json scripts/set-env.ts --test",
"prestart:dev": "yarn run config:dev",
"prestart:prod": "yarn run config:prod",
"prebuild": "yarn run config:dev",
"pretest": "yarn run config:test",
"pretest:headless": "yarn run config:test",

View File

@@ -43,6 +43,7 @@ import(environmentFilePath)
.catch(() => generateEnvironmentFile(merge(commonEnv, processEnv)));
function generateEnvironmentFile(file: GlobalConfig): void {
console.log(file);
buildBaseUrls(file);
const contents = `export const environment = ` + JSON.stringify(file);
console.log(colors.magenta('The file `environment.ts` will be written with the following content: \n'));
@@ -54,12 +55,18 @@ function generateEnvironmentFile(file: GlobalConfig): void {
console.log(colors.magenta(`Angular environment.ts file generated correctly at ${targetPath} \n`));
}
});
console.log(file);
}
// allow to override a few important options by environment variables
function createServerConfig(host?: string, port?: string, nameSpace?: string, ssl?: string): ServerConfig {
const result = { host, nameSpace } as any;
const result = {} as any;
if (hasValue(host)) {
result.host = host;
}
if (hasValue(nameSpace)) {
result.host = nameSpace;
}
if (hasValue(port)) {
result.port = Number(port);
@@ -75,6 +82,8 @@ function createServerConfig(host?: string, port?: string, nameSpace?: string, s
function buildBaseUrls(config: GlobalConfig): void {
for (const key in config) {
if (config.hasOwnProperty(key) && config[key].host) {
console.log(key);
console.log(config[key]);
config[key].baseUrl = [
getProtocol(config[key].ssl),
getHost(config[key].host),

View File

@@ -3,7 +3,7 @@ import { NotificationAnimationsType } from './notification-animations-type';
export interface INotificationOptions {
timeOut: number;
clickToClose: boolean;
animate: NotificationAnimationsType;
animate: NotificationAnimationsType | string;
}
export class NotificationOptions implements INotificationOptions {
@@ -13,7 +13,7 @@ export class NotificationOptions implements INotificationOptions {
constructor(timeOut = 5000,
clickToClose = true,
animate = NotificationAnimationsType.Scale) {
animate: NotificationAnimationsType | string = NotificationAnimationsType.Scale) {
this.timeOut = timeOut;
this.clickToClose = clickToClose;

View File

@@ -14,7 +14,7 @@ export interface BrowseByTypeConfig extends Config {
/**
* The type of Browse-By page to render
*/
type: BrowseByType;
type: BrowseByType | string;
/**
* The metadata field to use for rendering starts-with options (only necessary when type is set to BrowseByType.Date)

View File

@@ -1,5 +0,0 @@
import { GlobalConfig } from '../config/global-config.interface';
export const environment: Partial<GlobalConfig> = {
production: false
};

View File

@@ -1,4 +0,0 @@
import { GlobalConfig } from '../config/global-config.interface';
export const environment: Partial<GlobalConfig> = {
};

View File

@@ -1 +1 @@
export const environment = {"production":true,"ui":{"ssl":false,"port":4000},"rest":{"ssl":true,"port":443},"cache":{"msToLive":{"default":900000},"control":"max-age=60","autoSync":{"defaultTime":0,"maxBufferSize":100,"timePerMethod":{"PATCH":3}}},"form":{"validatorMap":{"required":"required","regex":"pattern"}},"notifications":{"rtl":false,"position":["top","right"],"maxStack":8,"timeOut":5000,"clickToClose":true,"animate":"scale"},"submission":{"autosave":{"metadata":["dc.title","dc.identifier.doi","dc.identifier.pmid","dc.identifier.arxiv"],"timer":5},"icons":{"metadata":[{"name":"dc.author","style":"fas fa-user"},{"name":"default","style":""}],"authority":{"confidence":[{"value":600,"style":"text-success"},{"value":500,"style":"text-info"},{"value":400,"style":"text-warning"},{"value":"default","style":"text-muted"}]}}},"universal":{"preboot":true,"async":true,"time":false},"gaTrackingId":"","logDirectory":".","debug":false,"defaultLanguage":"en","languages":[{"code":"en","label":"English","active":true},{"code":"de","label":"Deutsch","active":true},{"code":"cs","label":"Čeština","active":true},{"code":"nl","label":"Nederlands","active":true},{"code":"pt","label":"Português","active":true}],"browseBy":{"oneYearLimit":10,"fiveYearLimit":30,"defaultLowerLimit":1900,"types":[{"id":"title","type":"title"},{"id":"dateissued","type":"date","metadataField":"dc.date.issued"},{"id":"author","type":"metadata"},{"id":"subject","type":"metadata"}]},"item":{"edit":{"undoTimeout":10000}},"collection":{"edit":{"undoTimeout":10000}},"theme":{"name":"default"}}
export const environment = {"production":true,"ui":{"ssl":false,"host":"localhost","port":4000,"nameSpace":"/","baseUrl":"http://localhost:4000/"},"rest":{"ssl":true,"host":"dspace7.4science.cloud","port":443,"nameSpace":"/server/api","baseUrl":"https://dspace7.4science.cloud/server/api"},"cache":{"msToLive":{"default":900000},"control":"max-age=60","autoSync":{"defaultTime":0,"maxBufferSize":100,"timePerMethod":{"PATCH":3}}},"form":{"validatorMap":{"required":"required","regex":"pattern"}},"notifications":{"rtl":false,"position":["top","right"],"maxStack":8,"timeOut":5000,"clickToClose":true,"animate":"scale"},"submission":{"autosave":{"metadata":["dc.title","dc.identifier.doi","dc.identifier.pmid","dc.identifier.arxiv"],"timer":5},"icons":{"metadata":[{"name":"dc.author","style":"fas fa-user"},{"name":"default","style":""}],"authority":{"confidence":[{"value":600,"style":"text-success"},{"value":500,"style":"text-info"},{"value":400,"style":"text-warning"},{"value":"default","style":"text-muted"}]}}},"universal":{"preboot":true,"async":true,"time":false},"gaTrackingId":"","logDirectory":".","debug":false,"defaultLanguage":"en","languages":[{"code":"en","label":"English","active":true},{"code":"de","label":"Deutsch","active":true},{"code":"cs","label":"Čeština","active":true},{"code":"nl","label":"Nederlands","active":true},{"code":"pt","label":"Português","active":true}],"browseBy":{"oneYearLimit":10,"fiveYearLimit":30,"defaultLowerLimit":1900,"types":[{"id":"title","type":"title"},{"id":"dateissued","type":"date","metadataField":"dc.date.issued"},{"id":"author","type":"metadata"},{"id":"subject","type":"metadata"}]},"item":{"edit":{"undoTimeout":10000}},"collection":{"edit":{"undoTimeout":10000}},"theme":{"name":"default"}}