Skip to content

Commit

Permalink
Final review
Browse files Browse the repository at this point in the history
  • Loading branch information
dickwolff committed Jan 27, 2025
1 parent 24c1bbc commit a17e4ff
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ docker run --rm -v {local_in-folder}:/var/tmp/e2g-input -v {local_out_folder}:/v

The following parameters can be given to the Docker run command.

| Command | Optional | Description |
| -------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-v {local_in-folder}:/var/tmp/e2g-input` | N | The input folder where you put the files to be processed |
| `-v {local_out_folder}:/var/tmp/e2g-output` | N | The output folder where the Ghostfolio import JSON will be placed. Also the input file will be moved here when an error ocurred while processing the file. |
| `-v {local_cache_folder}:/var/tmp/e2g-cache` | Y | The folder where Yahoo Finance symbols will be cached |
| `--env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx` | N | Your Ghostolio account ID [^1] |
| `--env isin-overrides.txt` | Y | Specify a key-value pair file with ISIN overrides |
| `--env USE_POLLING=true` | Y | When set to true, the container will continously look for new files to process and the container will not stop. |
| `--env DEBUG_LOGGING=true` | Y | When set to true, the container will show logs in more detail, useful for error tracing. |
| `--env PURGE_CACHE=true` | Y | When set to true, the file cache will be purged on start. |
| `--env GHOSTFOLIO_SPLIT_OUTPUT=true` | Y | When set to true, the result file will be split into chunks of 25 activities, allowing it to be uploaded to [Ghostfolio's hosted service](https://ghostfol.io). |
| `--env GHOSTFOLIO_VALIDATE=true` | Y | When set to true, the tool with automatically validate the generated file against Ghostfolio. |
| `--env GHOSTFOLIO_IMPORT=true` | Y | When set to true, the tool will try to automatically import the generated file into Ghostfolio. |
| `--env GHOSTFOLIO_URL=http://xxxxxxx` | Y | The endpoint of your **local** Ghostfolio instance. E.g. `http://192.168.1.15:3333`. **Use ONLY with a local Ghostfolio instance!** |
| `--env GHOSTFOLIO_SECRET=xxxxxxx` | Y | The credentials of your Ghostfolio user. Used to authenticate with the `import` API endpoint. **Use ONLY with a local Ghostfolio instance!** |
| Command | Optional | Description |
| ------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-v {local_in-folder}:/var/tmp/e2g-input` | N | The input folder where you put the files to be processed |
| `-v {local_out_folder}:/var/tmp/e2g-output` | N | The output folder where the Ghostfolio import JSON will be placed. Also the input file will be moved here when an error ocurred while processing the file. |
| `-v {local_cache_folder}:/var/tmp/e2g-cache` | Y | The folder where Yahoo Finance symbols will be cached |
| `--env GHOSTFOLIO_ACCOUNT_ID=xxxxxxx` | N | Your Ghostolio account ID [^1] |
| `--env ISIN_OVERRIDE_FILE=isin-overrides.txt` | Y | Specify a key-value pair file with ISIN overrides |
| `--env USE_POLLING=true` | Y | When set to true, the container will continously look for new files to process and the container will not stop. |
| `--env DEBUG_LOGGING=true` | Y | When set to true, the container will show logs in more detail, useful for error tracing. |
| `--env PURGE_CACHE=true` | Y | When set to true, the file cache will be purged on start. |
| `--env GHOSTFOLIO_SPLIT_OUTPUT=true` | Y | When set to true, the result file will be split into chunks of 25 activities, allowing it to be uploaded to [Ghostfolio's hosted service](https://ghostfol.io). |
| `--env GHOSTFOLIO_VALIDATE=true` | Y | When set to true, the tool with automatically validate the generated file against Ghostfolio. |
| `--env GHOSTFOLIO_IMPORT=true` | Y | When set to true, the tool will try to automatically import the generated file into Ghostfolio. |
| `--env GHOSTFOLIO_URL=http://xxxxxxx` | Y | The endpoint of your **local** Ghostfolio instance. E.g. `http://192.168.1.15:3333`. **Use ONLY with a local Ghostfolio instance!** |
| `--env GHOSTFOLIO_SECRET=xxxxxxx` | Y | The credentials of your Ghostfolio user. Used to authenticate with the `import` API endpoint. **Use ONLY with a local Ghostfolio instance!** |

[^1]: You can retrieve your Ghostfolio account ID by going to Accounts > Edit for your account and copying the Account ID field

Expand Down
14 changes: 7 additions & 7 deletions src/securityService.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as cacache from "cacache";
import { writeFileSync } from "fs";
import { SecurityService } from "./securityService";
import YahooFinanceServiceMock from "./testing/yahooFinanceServiceMock";
import { writeFileSync } from "fs";

describe("securityService", () => {

Expand Down Expand Up @@ -513,8 +513,8 @@ describe("securityService", () => {
// Arrange

// Override the environment variable and force Jest to reload all modules.
const oldEnv = process.env.E2G_ISIN_OVERRIDE_FILE;
process.env.E2G_ISIN_OVERRIDE_FILE = "isin-overrides-sample.txt";
const oldEnv = process.env.ISIN_OVERRIDE_FILE;
process.env.ISIN_OVERRIDE_FILE = "isin-overrides-sample.txt";
jest.resetModules();
const { SecurityService } = require("./securityService");

Expand All @@ -537,7 +537,7 @@ describe("securityService", () => {
expect(searchSpy).toHaveBeenCalledTimes(1);

// Cleanup
process.env.E2G_ISIN_OVERRIDE_FILE = oldEnv;
process.env.ISIN_OVERRIDE_FILE = oldEnv;
});
});
});
Expand Down Expand Up @@ -617,8 +617,8 @@ describe("securityService", () => {
writeFileSync("isin-overrides-test.txt", file, { encoding: "utf8", flag: "w" });

// Override the environment variable and force Jest to reload all modules.
const oldEnv = process.env.E2G_ISIN_OVERRIDE_FILE;
process.env.E2G_ISIN_OVERRIDE_FILE = "isin-overrides-test.txt";
const oldEnv = process.env.ISIN_OVERRIDE_FILE;
process.env.ISIN_OVERRIDE_FILE = "isin-overrides-test.txt";
jest.resetModules();
const { SecurityService } = require("./securityService");

Expand All @@ -633,7 +633,7 @@ describe("securityService", () => {
expect(cache[2]).toBe(2);

// Cleanup
process.env.E2G_ISIN_OVERRIDE_FILE = oldEnv;
process.env.ISIN_OVERRIDE_FILE = oldEnv;
});
});
});
2 changes: 1 addition & 1 deletion src/securityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { mapReplacer, mapReviver } from "./helpers/dictionaryHelpers";
const cachePath = process.env.E2G_CACHE_FOLDER || "/var/tmp/e2g-cache";

/* istanbul ignore next */
const symbolOverrideFile = process.env.E2G_ISIN_OVERRIDE_FILE || "isin-overrides.txt";
const symbolOverrideFile = process.env.ISIN_OVERRIDE_FILE || "isin-overrides.txt";

export class SecurityService {

Expand Down
3 changes: 2 additions & 1 deletion src/testing/testEnvVars.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
process.env.E2G_CACHE_FOLDER = "/var/tmp/e2g-cache-unittest"
process.env.E2G_ISIN_OVERRIDE_FILE = "doesnotexist.txt";

process.env.ISIN_OVERRIDE_FILE = "doesnotexist.txt";

process.env.GHOSTFOLIO_ACCOUNT_ID = "aa11bb22cc33"

0 comments on commit a17e4ff

Please sign in to comment.