add template file, update readme, remove logs

This commit is contained in:
Art Lowel
2020-03-27 15:51:54 +01:00
parent 1caec64115
commit f61f92e1ad
3 changed files with 43 additions and 27 deletions

View File

@@ -79,39 +79,46 @@ Installing
Default configuration file is located in `src/environments/` folder.
To change the default configuration values, create local files that override the parameters you need to change:
To change the default configuration values, create local files that override the parameters you need to change. You can use `environment.template.ts` as a starting point.
- Create a new `environment.dev.ts` file in `src/environments/` for `development` environment;
- Create a new `environment.prod.ts` file in `src/environments/` for `production` environment;
- Create a new `environment.dev.ts` file in `src/environments/` for a `development` environment;
- Create a new `environment.prod.ts` file in `src/environments/` for a `production` environment;
To use the configuration parameters in your component:
```bash
import { environment } from '../environment.ts';
```
This file is generated by the script located in `scripts/set-env.ts`.
The server settings can be overwritten using an environment file.
The server settings can also be overwritten using an environment file.
This file should be called `.env` and be placed in the project root.
The following settings can be overwritten in this file:
```
DSPACE_HOST // The host name of the angular application
DSPACE_PORT // The port number of the angular application
DSPACE_NAMESPACE // The namespace of the angular application
DSPACE_SSL // Whether the angular application uses SSL [true/false]
```bash
DSPACE_HOST # The host name of the angular application
DSPACE_PORT # The port number of the angular application
DSPACE_NAMESPACE # The namespace of the angular application
DSPACE_SSL # Whether the angular application uses SSL [true/false]
DSPACE_REST_HOST // The host name of the REST application
DSPACE_REST_PORT // The port number of the REST application
DSPACE_REST_NAMESPACE // The namespace of the REST application
DSPACE_REST_SSL // Whether the angular REST uses SSL [true/false]
DSPACE_REST_HOST # The host name of the REST application
DSPACE_REST_PORT # The port number of the REST application
DSPACE_REST_NAMESPACE # The namespace of the REST application
DSPACE_REST_SSL # Whether the angular REST uses SSL [true/false]
```
The same settings can also be overwritten by setting system environment variables instead, E.g.:
```export DSPACE_HOST=https://dspace7.4science.cloud/server```
```bash
export DSPACE_HOST=https://dspace7.4science.cloud/server
```
The priority works as follows: **environment variable** overrides **variable in `.env` file** overrides **`environment.(prod, dev or test).ts`** overrides **`environment.common.ts`**
#### Using environment variables in code
To use environment variables in a UI component, use:
```typescript
import { environment } from '../environment.ts';
```
This file is generated by the script located in `scripts/set-env.ts`. This script will run automatically before every build, or can be manually triggered using the appropriate `config` script in `package.json`
Running the app
---------------