Skip to content

Refactor Server Startup Options #404

@s-heppner

Description

@s-heppner

Currently, the existing startup-options (environment variables) are undocumented and confusing. One can only assume what they do by reading the code from server/app/main.py.

We propose the following improvements:

  1. Refactor the functionalty of reading arbitrary JSON, XML, AASX files from a given directory into an ObjectStore from here to sdk/basyx/aas/adapter/__init__.py as a reusable function. (And reuse them in step 2-3)

  2. Split the current STORAGE_PATH directory into two separate directories: STORAGE (as in the directory for the LocalFileObjectStore, if data persistence is needed) and INPUT (is there a better name?), for the data that should be loaded into the server via startup.

The reason for this split is that it is very difficult to recreate the exact files (AASX, JSON, XML) with multiple Identifiables per file and optional supplementary files from the LocalFileObjectStore, therefore editing them with changes to make them persistent is hard. Instead, now we have the data that is read during startup of the server split from the directory that ensures data persistence across server reboots.

Expected behavior would be the following:

  • Any Identifiable in the INPUT directory, that is not present in the LocalFileObjectStore gets added to the LocalFileObjectStore (and with that to the STORAGE directory.
  • Any Identifiable in the INPUT directory that alread is inside the LocalFileObjectStore gets skipped (unless an other startup-option "OVERRIDE_PERSISTENT_DATA_VIA_INPUT" (better name is welcome as well) is set, in which case, the Identifiable in the LocalFileObjectStore should be replaced by the one from the INPUT directory.
  1. Rename the LOCAL_FILE_READ_ONLY option to something more like MEMORY_ONLY, wheras the other option (see 2.) should have a discriptive name as well e.g. LOCAL_FILE? These options could be called something like PERSISTENCE options.

  2. Lastly, cleary document the options and their behavior in the README.md and possible also the module docstring of main.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement of an existing featureserverSomething to do with the `server` package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions