src/environments/environment#environment TypeScript Examples

The following examples show how to use src/environments/environment#environment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: gnosis.service.ts    From gnosis.1inch.exchange with MIT License 6 votes vote down vote up
public addListeners(): void {
        if (!environment.production) {
            this.walletAddress.next('0x3a13D9b322F391a1AFab36a1d242C24F3250bA48');
            return;
        }

        appsSdk.addListeners({
            onSafeInfo: ((info: SafeInfo) => {

                this.isMainNet.next(info.network.toLowerCase() === 'mainnet');
                this.walletAddress.next(info.safeAddress);
            })
        });
    }
Example #2
Source File: app.module.ts    From Uber-ServeMe-System with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
  ],
  entryComponents: [],
  imports: [
    BrowserModule, 
    IonicModule.forRoot({
      // toastEnter: customAlertEnter
    }), 
    AppRoutingModule,
    AngularFireModule.initializeApp(environment.firebase),
    AngularFirestoreModule, 
    AngularFireStorageModule,
    AngularFireAuthModule,
    HttpModule,
    AngularFireAuthModule,
    FirebaseUIModule.forRoot(firebaseUiAuthConfig),
  ],
  providers: [
    Keyboard,
    GoogleMaps,
    NativeStorage,
    GooglePlus,
    StatusBar,
    SplashScreen,
    UserService,
    AngularFirestore,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
Example #3
Source File: login.component.ts    From ng-devui-admin with MIT License 6 votes vote down vote up
handleAuth(type: string) {
    console.log(type);
    //github oauth配置
    const config = {
      oauth_uri: 'https://github.com/login/oauth/authorize',
      redirect_uri: 'https://devui.design/admin/login',
      client_id: 'ef3ce924fcf915c50910',
    };
    if (!environment.production) {
      config.redirect_uri = 'http://localhost:8001/login';
      config.client_id = 'ecf5e43d804e8e003196';
    }
    window.location.href = `${config.oauth_uri}?client_id=${config.client_id}&redirect_uri=${config.redirect_uri}`;
  }
Example #4
Source File: network-toggle.component.ts    From thorchain-explorer-singlechain with MIT License 6 votes vote down vote up
constructor(@Inject(DOCUMENT) private document: Document) {

    switch (environment.network) {
      case 'TESTNET':
        this.network = THORChainNetwork.TESTNET;
        break;

      default:
        this.network = THORChainNetwork.CHAOSNET;
        break;
    }

  }
Example #5
Source File: websocket.service.ts    From App with MIT License 6 votes vote down vote up
/**
	 * Create a single purpose connection to the websocket.
	 *
	 * A WebSocket connection will be created, then an event will be sent;
	 * the connection remains active until the server closes it.
	 */
	createSinglePurposeConnection<T>(eventName: string, payload?: any): Observable<WebSocketService.SinglePurposePacket<T>> {
		return new Observable<WebSocketService.SinglePurposePacket<T>>(observer => {
			const ws = new WebSocket(environment.wsUrl); // Establish websocket connection

			ws.onopen = () => {
				this.logger.info(`<WS> Connected to ${environment.wsUrl}`);

				ws.onmessage = ev => { // Listen for messages
					let data: WebSocketService.SinglePurposePacket<T> | undefined;
					try { // Parse JSON
						data = JSON.parse(ev.data) as WebSocketService.SinglePurposePacket<T>;
					} catch (err) { observer.error(err); }
					if (!data) return undefined;

					// Emit the packet
					observer.next(data);

					return undefined;
				};

				// Listen for closure
				ws.onclose = ev => {
					if (ev.code === 1000)
						observer.complete();
					else
						observer.error(new WebSocketService.NonCompleteClosureError(ev.code, ev.reason));
				};

				// Send the event, requesting the server to begin sending us data
				ws.send(JSON.stringify({ type: eventName, payload }));
			};
		});
	}
Example #6
Source File: formedit.compo.ts    From CloudeeCMS with Apache License 2.0 6 votes vote down vote up
ngOnInit() {
        const that = this;
        this.formAPIURL = environment.API_Gateway_Endpoint + '/user-forms';
        if (this.docid === 'NEW') {
            this.frm = new Form();
            this.frm.staticcaptcha = that.tabsSVC.getGUID();
            this.tabsSVC.setTabTitle(this.tabid, 'New Form');
            this.loading = false;
            setTimeout(() => { that.setLoading(false); }, 1000); // delay to prevent error
            // enable trumbowyg editor onchange tracking
            setTimeout(() => { that.editorTrackChanges = true; }, 2000);
        } else {
            this.loadByID(this.docid);
        }
    }
Example #7
Source File: app.component.ts    From RoboScan with GNU General Public License v3.0 6 votes vote down vote up
onStartScanning() {
    if (environment.production) {
      this.scannerApi.startScan(this.sessionId).subscribe(data => {
        console.log(data);
      });
    } else {
      this.stepper.next();
    }
  }
Example #8
Source File: message.service.ts    From bitcoin-s-ts with MIT License 6 votes vote down vote up
private sendServerMessage(message: OracleServerMessage, errorHandling: boolean) {
    const url = environment.oracleServerApi
    const options = {}
    // Set at server now
    // if (this.authService.password) {
    //   let headers = new Headers()
    //   headers.set('Authorization', this.authService.serverAuthHeader)
    // }
    let obs = this.http.post<OracleResponse<any>>(url, message, options)

    if (errorHandling) {
      return obs.pipe(catchError((error: any, caught: Observable<unknown>) => {
        console.error('sendMessage error', error)
        let message = error?.error?.error
        const dialog = this.dialog.open(ErrorDialogComponent, {
          data: {
            title: 'dialog.sendMessageError.title',
            content: message,
          }
        })
        throw(Error('sendMessage error' + error))
        return new Observable<any>() // required for type checking...
      }))
    } else {
      return obs
    }
  }
Example #9
Source File: data.service.ts    From oss-github-benchmark with GNU General Public License v3.0 6 votes vote down vote up
async loadData(): Promise<IData> {
    const data = await this.http
      .get<ISector>(`${environment.api}institutions`)
      .toPromise();
    const repoData = await this.http
      .get<ISector>(`${environment.api}repositories`)
      .toPromise();
    return {
      csvData: this.parseJSON2CSV(data),
      jsonData: data,
    };
  }
Example #10
Source File: networks.service.ts    From Elastos.Essentials.App with MIT License 6 votes vote down vote up
/**
   * Gets the list of supported chain IDs from the backend, so we know on which networks
   * we can allow users to created red packets.
   */
  public async fetchSupportedNetworks(): Promise<void> {
    try {
      this.supportedNetworks = await this.http.get<PublicNetworkInfo[]>(`${environment.RedPackets.serviceUrl}/chains`).toPromise();
      if (!this.supportedNetworks) {
        Logger.warn("redpackets", "Unable to fetch supported networks. Red packets can't be created later.");
        this.supportedNetworks = [];
      }
      else {
        Logger.log("redpackets", "Got list of supported networks for red packets", this.supportedNetworks);
      }
    }
    catch (err) {
      Logger.error("redpackets", "Unable to fetch supported networks. Red packets can't be created later.", err);
      this.supportedNetworks = [];
    }
  }
Example #11
Source File: image-selector.component.ts    From img-labeler with MIT License 6 votes vote down vote up
ngAfterViewInit(): void {
    this.activatedRoute.queryParams.subscribe(params => {
      if (params.imageNumber) {
        this.updateImageByNum(params.imageNumber);
      } else {
        this.updateImageByNum(environment.defaultImageNumber);
      }
      setTimeout(() => {
        if (params.showMask) {
          if (params.showMask === 'true') {
            this.showMask();
          } else {
            this.showMask(params.showMask)
          }
        }
      });

    });
  }
Example #12
Source File: app.component.ts    From fyle-mobile-app with MIT License 6 votes vote down vote up
checkAppSupportedVersion() {
    this.deviceService
      .getDeviceInfo()
      .pipe(
        switchMap((deviceInfo) => {
          const data = {
            app_version: deviceInfo.appVersion,
            device_os: deviceInfo.platform,
          };

          return this.appVersionService.isSupported(data);
        })
      )
      .subscribe(async (res: { message: string; supported: boolean }) => {
        if (!res.supported && environment.production) {
          const deviceInfo = await this.deviceService.getDeviceInfo().toPromise();
          const eou = await this.authService.getEou();

          this.trackingService.eventTrack('Auto Logged out', {
            lastLoggedInVersion: await this.loginInfoService.getLastLoggedInVersion(),
            user_email: eou && eou.us && eou.us.email,
            appVersion: deviceInfo.appVersion,
          });

          this.router.navigate(['/', 'auth', 'app_version', { message: res.message }]);
        }
      });
  }
Example #13
Source File: chat-page.component.ts    From avid-covider with MIT License 6 votes vote down vote up
init() {
    this.content = new ContentManager();
    this.runner = new ScriptRunnerImpl(this.http, this.content, this.locale);
    this.runner.timeout = environment.chatRunnerTimeout;
    this.runner.debug = false;
    this.runner.fixme = () => {
      this.restart();
    };
  }
Example #14
Source File: server-info.component.ts    From models-web-app with Apache License 2.0 6 votes vote down vote up
ngOnInit() {
    this.route.params.subscribe(params => {
      console.log($localize`Using namespace: ${params.namespace}`);
      this.ns.updateSelectedNamespace(params.namespace);

      this.serverName = params.name;
      this.namespace = params.namespace;

      this.pollingSub = this.poller.start().subscribe(() => {
        this.getBackendObjects();
      });
    });

    // don't show a METRICS tab if Grafana is not exposed
    console.log($localize`Checking if Grafana endpoint is exposed`);
    const grafanaApi = environment.grafanaPrefix + '/api/search';

    this.http
      .get(grafanaApi)
      .pipe(timeout(1000))
      .subscribe({
        next: resp => {
          if (!Array.isArray(resp)) {
            console.log(
              $localize`Response from the Grafana endpoint was not as expected.`,
            );
            this.grafanaFound = false;
            return;
          }

          console.log($localize`Grafana endpoint detected. Will expose a metrics tab.`);
          this.grafanaFound = true;
        },
        error: () => {
          console.log($localize`Could not detect a Grafana endpoint..`);
          this.grafanaFound = false;
        },
      });
  }
Example #15
Source File: youtube.service.ts    From litefy with MIT License 6 votes vote down vote up
getVideoFromApi(artist: string, trackName: string): Observable<any> {
        const key = environment.youtube_api_key;
        return this.http
            .get<any>(
                `https://www.googleapis.com/youtube/v3/search?part=snippet&videoCategoryId=10&maxResults=1&q=${artist} - ${trackName}&type=video&key=${key}`
            )
            .pipe(
                map((item) => {
                    const videoId = item.items[0].id.videoId;
                    return videoId;
                })
            );
    }
Example #16
Source File: jwt.interceptor.ts    From nuxx with GNU Affero General Public License v3.0 6 votes vote down vote up
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
        // add auth header with jwt if user is logged in and request is to the api url
        const currentUser = this.authenticationService.currentUserValue;
        const isLoggedIn = currentUser && currentUser.token;
        const isApiUrl = request.url.startsWith(environment.apiUrl);
        if (isLoggedIn && isApiUrl && (!request.url.includes('social/github/login') || request.url === `${environment.apiUrl}/recipe/`)) {
            request = request.clone({
                setHeaders: {
                    Authorization: `JWT ${currentUser.token}`
                }
            });
        }

        return next.handle(request);
    }
Example #17
Source File: chat-record.service.ts    From onchat-web with Apache License 2.0 6 votes vote down vote up
/**
   * 获取聊天记录
   * @param id 页码
   * @param chatroomId 聊天室ID
   */
  getChatRecords(id: number, chatroomId: number): Observable<Result<Message[]>> {
    const params = { id: id.toString() };
    return this.http.get<Result<Message[]>>(`${environment.chatRecordCtx}/records/${chatroomId}`, { params });
  }
Example #18
Source File: healthcheck.service.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
public healthCheck(): Promise<boolean> {
    return new Promise(resolve => {
      this.httpClient
        .get(`${ENVIRONMENT.apiBaseUrl}/healthcheck/`, { observe: 'response' })
        .subscribe(
          response => resolve(response.status === 200),
          () => resolve(false)
        );
    });
  }
Example #19
Source File: graphql.module.ts    From one-platform with MIT License 5 votes vote down vote up
uri = environment.API_URL
Example #20
Source File: side-bar.component.ts    From Smersh with MIT License 5 votes vote down vote up
public version = environment.version;
Example #21
Source File: server.shims.ts    From ng-conf-2020-workshop with MIT License 5 votes vote down vote up
template = readFileSync(join(process.cwd(), environment.distFolder, 'index.html'), 'utf-8')
Example #22
Source File: user.service.ts    From master-frontend-lemoncode with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) {
    this.apiUrl = environment.apiUrl + 'users';
  }
Example #23
Source File: loader.component.ts    From nica-os with MIT License 5 votes vote down vote up
environment = environment;
Example #24
Source File: navigation.component.ts    From App with MIT License 5 votes vote down vote up
envName = environment.name as 'dev' | 'stage';
Example #25
Source File: userlogin.service.ts    From CloudeeCMS with Apache License 2.0 5 votes vote down vote up
constructor() {
    this.cognitoAllowUserPassLogin = environment.cognitoAllowUserPassLogin;
    this.cognitoAllowOAuthLogin = environment.cognitoAllowOAuthLogin;
    this.federatedLoginLabel = environment.federatedLoginLabel || 'Single Sign On';
    Hub.listen('auth', this.authListener);
    this.checkLoggedIn();
  }
Example #26
Source File: home.component.ts    From worktez with MIT License 5 votes vote down vote up
public useEmulator = environment.useEmulators;
Example #27
Source File: auth.service.ts    From ReCapProject-Frontend with MIT License 5 votes vote down vote up
apiControllerUrl: string = `${environment.apiUrl}/auth`;