refactor: use other way to save env

This commit is contained in:
Polianin Nikita 2024-06-15 00:37:12 +03:00
parent aca3eb457a
commit c91973b185
6 changed files with 17 additions and 6 deletions

View File

@ -49,7 +49,13 @@
"development": { "development": {
"optimization": false, "optimization": false,
"extractLicenses": false, "extractLicenses": false,
"sourceMap": true "sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
} }
}, },
"defaultConfiguration": "production" "defaultConfiguration": "production"

View File

@ -1,7 +1,7 @@
import {catchError, mergeMap, Observable, retryWhen, timer} from "rxjs"; import {catchError, mergeMap, Observable, retryWhen, timer} from "rxjs";
import {HttpClient, HttpErrorResponse} from "@angular/common/http"; import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {NotifyColor, OpenNotifyService} from "@service/open-notify.service"; import {NotifyColor, OpenNotifyService} from "@service/open-notify.service";
import {environment} from "@/config/environment"; import {environment} from "@environment";
import {Router} from "@angular/router"; import {Router} from "@angular/router";
import {Injectable} from "@angular/core"; import {Injectable} from "@angular/core";

View File

@ -1,6 +1,5 @@
export const environment = { export const environment = {
apiUrl: 'http://localhost:5269/api/', apiUrl: 'http://localhost:5269/api/',
production: false, maxRetry: 5,
maxRetry: 3,
retryDelay: 1500 retryDelay: 1500
} };

View File

@ -0,0 +1,5 @@
export const environment = {
apiUrl: '',
maxRetry: 3,
retryDelay: 1500
};

View File

@ -6,7 +6,7 @@ import {MatInput} from "@angular/material/input";
import {AsyncPipe} from "@angular/common"; import {AsyncPipe} from "@angular/common";
import {FormControl, ReactiveFormsModule, Validators} from "@angular/forms"; import {FormControl, ReactiveFormsModule, Validators} from "@angular/forms";
import SetupService from "@api/v1/setup.service"; import SetupService from "@api/v1/setup.service";
import {environment} from "@/config/environment"; import {environment} from "@environment";
import {AvailableVersion} from "@api/api.service"; import {AvailableVersion} from "@api/api.service";
@Component({ @Component({

View File

@ -37,6 +37,7 @@
"./src/shared/requests/*", "./src/shared/requests/*",
"./src/api/*" "./src/api/*"
], ],
"@environment": ["./src/environments/environment.ts"],
"@/*": [ "@/*": [
"./src/*" "./src/*"
] ]