Skip to content

Commit

Permalink
Convert proxy and retriever to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Dec 2, 2023
1 parent 9c6bacf commit de23cf3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@
"instances": 1
},
{
"script": "svc/retriever.js",
"script": "svc/retriever.mjs",
"watch": true,
"ignore_watch": [".git", "node_modules"],
"group": "retriever",
"exec_mode": "cluster",
"instances": 1
},
{
"script": "svc/proxy.js",
"script": "svc/proxy.mjs",
"watch": true,
"ignore_watch": [".git", "node_modules"],
"group": "proxy",
Expand Down
8 changes: 4 additions & 4 deletions svc/proxy.js → svc/proxy.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* Worker proxying requests to the Steam API.
* */
const httpProxy = require('http-proxy');
const http = require('http');
const config = require('../config');
import httpProxy from 'http-proxy';
import http from 'http';
import {PORT, PROXY_PORT} from '../config.js';

const PORT = config.PORT || config.PROXY_PORT;
const PORT = PORT || PROXY_PORT;
const proxy = httpProxy.createProxyServer({
target: 'http://api.steampowered.com',
changeOrigin: true,
Expand Down
29 changes: 10 additions & 19 deletions svc/retriever.js → svc/retriever.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@
* Worker interfacing with the Steam GC.
* Provides HTTP endpoints for other workers.
* */
const Steam = require('steam');
const Dota2 = require('dota2');
const async = require('async');
const express = require('express');
const compression = require('compression');
const cp = require('child_process');
const os = require('os');
const config = require('../config');

const advancedAuth = config.ENABLE_RETRIEVER_ADVANCED_AUTH
? {
/* eslint-disable global-require */
redis: require('../store/redis'),
crypto: require('crypto'),
/* eslint-enable global-require */
pendingTwoFactorAuth: {},
pendingSteamGuardAuth: {},
}
: null;
import Steam from 'steam';
import Dota2 from 'dota2';
import async from 'async';
import express from 'express';
import compression from 'compression';
import cp from 'child_process';
import os from 'os';
import config from '../config.js';

const advancedAuth = null;

const app = express();
const steamObj = {};
Expand Down

0 comments on commit de23cf3

Please sign in to comment.