···234234file_paths = [ "compose.yaml" ]
235235env_file_path = ".komodoEnv"
236236additional_env_files = [ ".env" ]
237237-[2025-08-08 13:47:17.496 -0400] INFO : [App] Contents written to /config/sync-2025-08-08--13-47-17.toml
238237[2025-08-08 13:47:17.496 -0400] INFO : [App] Done!
239238```
240239···254253255254## Writing Generated TOML to File
256255257257-Komodo Import will additionally attempt to write the generated output to a `.toml` file in the `/config` folder within its container.
256256+Komodo Import will additionally attempt to write the generated output to a `.toml` file if the ENV `OUTPUT_DIR` is present. This should be the *directory* (not file) that the generated file should be written to.
257257+258258+Bind mount a folder into the container and set `OUTPUT_DIR` like in the example below:
259259+260260+<details>
261261+262262+<summary>File Output Example</summary>
263263+264264+```yaml
265265+services:
266266+ komodo-import:
267267+ # ...
268268+ environment:
269269+ # ...
270270+ - OUTPUT_DIR=/output
271271+ volumes:
272272+ # ...
273273+ - /my/host/folder:/output
274274+```
258275259259-To use/persist these files, bind mount a folder to `/config` -- see example [compose.yaml](./compose.yaml) in the commented out `volume` lines.276276+</details>
+25
src/exporters/exportToFile.ts
···11+import { childLogger, Logger } from "@foxxmd/logging";
22+import { fileOrDirectoryIsWriteable } from "../common/utils/io.js";
33+import { mkdir, writeFile, chmod, constants } from 'node:fs/promises';
44+import path from "path";
55+import dayjs from 'dayjs'
66+import { isDebugMode } from "../common/utils/utils.js";
77+88+export const exportToFile = async (toml: string, parentLogger: Logger): Promise<void> => {
99+ const logger = childLogger(parentLogger, 'File Export');
1010+ const outputDir = process.env.OUTPUT_DIR;
1111+ if (outputDir !== undefined && outputDir.trim() !== '') {
1212+ const time = dayjs().format('YYYY-MM-DD--HH-mm-ss');
1313+ const outputFile = path.join(outputDir, `sync-${time}.toml`);
1414+ try {
1515+ fileOrDirectoryIsWriteable(outputDir);
1616+ await mkdir(outputDir, { recursive: true });
1717+ await writeFile(outputFile, toml);
1818+ logger.info(`Contents written to ${outputFile}`);
1919+ } catch (e) {
2020+ logger.warn(new Error(`Unable to write toml to file ${outputFile}`, { cause: e }));
2121+ }
2222+ } else if(isDebugMode()) {
2323+ logger.debug('Not writing to file because OUTPUT_DIR is empty or not defined.');
2424+ }
2525+}
+16
src/exporters/exportToLog.ts
···11+import { Logger } from "@foxxmd/logging";
22+import { parseBool } from "../common/utils/utils.js";
33+import { stripIndents } from "common-tags";
44+55+const separator = '✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️';
66+77+export const exportToLog = (toml: string, logger: Logger) => {
88+ if(parseBool(process.env.LOG_TOML ?? true)) {
99+ logger.info(stripIndents`
1010+ Copy the text between the scissors to use as the *Resource File* contents within your Resource Sync
1111+1212+ ${separator}
1313+ ${toml}
1414+ ${separator}`);
1515+ }
1616+}
+5-15
src/index.ts
···1515import { buildFileStack, buildFileStacks } from './builders/stack/filesOnServer.js';
1616import { CommonImportOptions } from './common/infrastructure/config/common.js';
1717import { FilesOnServerConfig } from './common/infrastructure/config/filesOnServer.js';
1818+import { KomodoClient, Types } from "komodo_client";
1919+import { exportToLog } from './exporters/exportToLog.js';
2020+import { exportToFile } from './exporters/exportToFile.js';
18211922dayjs.extend(utc)
2023dayjs.extend(timezone);
···3639const configDir = process.env.CONFIG_DIR || path.resolve(projectDir, `./config`);
37403841try {
3939-4040- initLogger.verbose(`Config Dir ENV: ${process.env.CONFIG_DIR} -> Resolved: ${configDir}`);
41424243 if (process.env.DEBUG_MODE !== undefined) {
4344 // make sure value is legit
···111112 stack: stacks
112113 };
113114114114- const time = dayjs().format('YYYY-MM-DD--HH-mm-ss');
115115-116115 let toml: string;
117116 let logTomlData = isDebugMode();
118117 try {
···126125 }
127126 }
128127129129- logger.info(`TOML:\n${toml}`);
130130-131131- const tomlFilePath = path.join(configDir, `sync-${time}.toml`);
132132- try {
133133- fileOrDirectoryIsWriteable(tomlFilePath);
134134- await promises.mkdir(configDir, { recursive: true });
135135- await writeFile(path.join(configDir, `sync-${time}.toml`), toml);
136136- logger.info(`Contents written to ${tomlFilePath}`);
137137- } catch (e) {
138138- logger.warn(new Error(`Unable to write toml to file`, { cause: e }));
139139- }
128128+ exportToLog(toml, logger);
129129+ await exportToFile(toml, logger);
140130141131 logger.info('Done!');
142132