Skip to content

Commit

Permalink
chore: remove NO_INTERNET code
Browse files Browse the repository at this point in the history
For #399.
  • Loading branch information
liammulh committed Apr 28, 2023
1 parent 667f5ed commit 6021626
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 35 deletions.
10 changes: 0 additions & 10 deletions src/server/translationApi/getLocaleInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
// import fs from 'fs';

import axios from 'axios';
import fs from 'fs';
import privateConfig from '../../common/privateConfig.js';
import publicConfig from '../../common/publicConfig.js';
import logger from './logger.js';

let timeOfLastUpdate = Number.NEGATIVE_INFINITY;
Expand All @@ -28,14 +26,6 @@ const getLocaleInfo = async () => {
logger.info( 'getting locale info' );
try {

// If working on the translation utility without an internet connection,
// mock the locale info with your local copy. (This assumes you have
// a local copy of locale info.)
if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) {
logger.info( 'using local copy of locale info' );
return JSON.parse( fs.readFileSync( './localeInfo.json' ) );
}

const localeInfoValidDurationElapsed = timeOfLastUpdate
+ privateConfig.VALID_LOCALE_INFO_DURATION < Date.now();

Expand Down
16 changes: 0 additions & 16 deletions src/server/translationApi/getSimMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* @author Liam Mulhall <liammulh@gmail.com>
*/

import fs from 'fs';
import axios from 'axios';
import privateConfig from '../../common/privateConfig.js';
import publicConfig from '../../common/publicConfig.js';
Expand Down Expand Up @@ -79,21 +78,6 @@ let simMetadata;
const getSimMetadata = async () => {
logger.info( 'getting sim metadata' );

// If working on the translation utility without an internet connection,
// mock the sim metadata with your local copy. (This assumes you have
// a local copy of sim metadata.)
try {
if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) {
logger.info( 'using local copy of sim metadata' );
return JSON.parse( fs.readFileSync( './simMetadata.json' ) );
}
}
catch( e ) {
logger.error( 'unable to get sim metadata' );
logger.error( e );
logger.error( 'this might be because you don\'t have a local copy of sim metadata' );
}

simMetadataMutex = simMetadataMutex.then( async () => {

const metadataValidDurationElapsed = timeOfLastUpdate +
Expand Down
9 changes: 0 additions & 9 deletions src/server/translationApi/getTranslationFormData.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// Uncomment this import of you want a local copy of translation form data.
// import fs from 'fs';

import fs from 'fs';
import privateConfig from '../../common/privateConfig.js';
import publicConfig from '../../common/publicConfig.js';
import getCommonTranslationFormData from './getCommonTranslationFormData.js';
Expand Down Expand Up @@ -76,14 +75,6 @@ const getTranslationFormData = async (
) => {
logger.info( 'getting translation form data' );

// If working on the translation utility without an internet connection,
// mock the translation form data with your local copy. (This assumes you have
// a local copy of translation form data.)
if ( publicConfig.ENVIRONMENT === 'development' && privateConfig.NO_INTERNET ) {
logger.info( 'using local copy of translation form data' );
return JSON.parse( fs.readFileSync( './translationFormData.json' ) );
}

// Try to get a saved translation from the short-term storage database.
if ( privateConfig.DB_ENABLED ) {
try {
Expand Down

0 comments on commit 6021626

Please sign in to comment.