···11-import * as dotenv from 'dotenv';
21import FS from 'fs';
32import path from 'path';
43import * as process from 'process';
···1514import { InstagramExportedPost } from './media/InstagramExportedPost';
1615import { decodeUTF8, InstagramMediaProcessor } from './media/media';
17161818-dotenv.config();
19172018const API_RATE_LIMIT_DELAY = 3000; // https://docs.bsky.app/docs/advanced-guides/rate-limits
2119···113111 *
114112 */
115113export async function main() {
116116- const SIMULATE = process.env.SIMULATE === "1";
117114 const config = AppConfig.fromEnv();
118115 config.validate();
119116···134131 username: process.env.BLUESKY_USERNAME,
135132 MIN_DATE,
136133 MAX_DATE,
137137- SIMULATE,
134134+ SIMULATE: config.isSimulateEnabled(),
138135 });
139136140137 // Setup BlueSky Client only used if SIMULATE is not configured.
141138 let bluesky: BlueskyClient | null = null;
142139143143- if (!SIMULATE) {
140140+ if (!config.isSimulateEnabled()) {
144141 logger.info("--- SIMULATE mode is disabled, posts will be imported ---");
145142 bluesky = new BlueskyClient(
146143 process.env.BLUESKY_USERNAME!,
···241238 }
242239243240 // If we are not simulating migration we create the post with the embedded media.
244244- if (!SIMULATE && bluesky) {
241241+ if (!config.isSimulateEnabled() && bluesky) {
245242 await new Promise((resolve) =>
246243 setTimeout(resolve, API_RATE_LIMIT_DELAY)
247244 );
···297294 }
298295299296 // If we are simulating the migration we want to inform the user the estimated time it may take.
300300- if (SIMULATE) {
297297+ if (config.isSimulateEnabled()) {
301298 const estimatedTime = calculateEstimatedTime(importedMedia);
302299 logger.info(`Estimated time for real import: ${estimatedTime}`);
303300 }