Skip to content

Commit

Permalink
Fix/make app runtime data folder configurable (#235)
Browse files Browse the repository at this point in the history
* fix: make app-runtime dataFolder configurable

* chore: version bumps
  • Loading branch information
jkoenig134 authored Aug 16, 2024
1 parent 5705734 commit d10609f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 24 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/app-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/app-runtime",
"version": "5.0.0",
"version": "5.0.1",
"description": "The App Runtime",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down Expand Up @@ -63,7 +63,7 @@
"@types/luxon": "^3.4.2"
},
"peerDependencies": {
"@nmshd/runtime": "^5.0.0"
"@nmshd/runtime": "^5.0.1"
},
"publishConfig": {
"access": "public",
Expand Down
11 changes: 7 additions & 4 deletions packages/app-runtime/src/AppConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ import { IConfigOverwrite } from "@nmshd/transport";
import { defaultsDeep } from "lodash";

export interface AppConfig extends RuntimeConfig {
logging: any;
accountsDbName: string;
applicationId: string;
applePushEnvironment?: "Development" | "Production";
allowMultipleAccountsWithSameAddress: boolean;
dataFolder: string;
}

export interface AppConfigOverwrite {
transportLibrary?: Omit<IConfigOverwrite, "supportedIdentityVersion">;
logging?: any;
accountsDbName?: string;
applicationId: string;
applePushEnvironment?: "Development" | "Production";
allowMultipleAccountsWithSameAddress?: boolean;
dataFolder?: string;
}

export function createAppConfig(...configs: AppConfigOverwrite[]): AppConfig {
const appConfig = {
const appConfig: Omit<AppConfig, "transportLibrary" | "applicationId"> & {
transportLibrary: Omit<IConfigOverwrite, "supportedIdentityVersion" | "platformClientId" | "platformClientSecret" | "baseUrl">;
} = {
accountsDbName: "accounts",
transportLibrary: {
datawalletEnabled: true
Expand Down Expand Up @@ -93,7 +95,8 @@ export function createAppConfig(...configs: AppConfigOverwrite[]): AppConfig {
location: "@nmshd/runtime:NotificationModule"
}
},
allowMultipleAccountsWithSameAddress: false
allowMultipleAccountsWithSameAddress: false,
dataFolder: "./data"
};

const mergedConfig = defaultsDeep({}, ...configs, appConfig);
Expand Down
2 changes: 1 addition & 1 deletion packages/app-runtime/src/AppRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export class AppRuntime extends Runtime<AppConfig> {

protected createDatabaseConnection(): Promise<IDatabaseConnection> {
this.logger.trace("Creating DatabaseConnection to LokiJS");
this.lokiConnection = new LokiJsConnection("./data", this.nativeEnvironment.databaseFactory);
this.lokiConnection = new LokiJsConnection(this.config.dataFolder, this.nativeEnvironment.databaseFactory);
this.logger.trace("Finished initialization of LokiJS connection.");

return Promise.resolve(this.lokiConnection);
Expand Down
1 change: 0 additions & 1 deletion packages/app-runtime/test/lib/TestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export class TestUtil {

return runtime_createAppConfig({
transportLibrary: transportOverride,
logging: {},
applicationId: "eu.enmeshed.test",
...configOverride
});
Expand Down
2 changes: 1 addition & 1 deletion packages/consumption/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/consumption",
"version": "5.0.0",
"version": "5.0.1",
"description": "The consumption library extends the transport library.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/content",
"version": "5.0.0",
"version": "5.0.1",
"description": "The content library defines data structures that can be transmitted using the transport library.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down
8 changes: 4 additions & 4 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/runtime",
"version": "5.0.0",
"version": "5.0.1",
"description": "The enmeshed client runtime.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down Expand Up @@ -65,10 +65,10 @@
"@js-soft/logging-abstractions": "^1.0.1",
"@js-soft/ts-serval": "2.0.10",
"@js-soft/ts-utils": "^2.3.3",
"@nmshd/consumption": "5.0.0",
"@nmshd/content": "5.0.0",
"@nmshd/consumption": "5.0.1",
"@nmshd/content": "5.0.1",
"@nmshd/crypto": "2.0.6",
"@nmshd/transport": "5.0.0",
"@nmshd/transport": "5.0.1",
"ajv": "^8.17.1",
"ajv-errors": "^3.0.0",
"ajv-formats": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/transport/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nmshd/transport",
"version": "5.0.0",
"version": "5.0.1",
"description": "The transport library handles backbone communication and content encryption.",
"homepage": "https://enmeshed.eu",
"repository": {
Expand Down

0 comments on commit d10609f

Please sign in to comment.