INTO-CPS-Association / DTaaS

:factory: :left_right_arrow: :busts_in_silhouette: Digital Twin as a Service
https://into-cps-association.github.io/DTaaS/
Other
116 stars 57 forks source link

Include configuration for git mode in libms #952

Closed prasadtalasila closed 1 month ago

prasadtalasila commented 2 months ago

This issue is relates to discussion #951. In order to support these new features, the first step is to create a git mode for libms. We need to have a git configuration. This configuration can be specified in .env of libms as follows.

PORT='4001'
MODE='git'
LOCAL_PATH='/Users/<Username>/DTaaS/files'
LOG_LEVEL='debug'
APOLLO_PATH='/lib' or ''
GRAPHQL_PLAYGROUND='false' or 'true'
nichlaes commented 1 month ago

@prasadtalasila I think I need some more context for this issue. What are the goals/requirements? Should it serve files from GIT?

prasadtalasila commented 1 month ago

@nichlaes Yes. To serve files over git without showing the .git files to users.

nichlaes commented 1 month ago

Hi Prasad.

Can you add the link you used to show me an example of the the users on gitlab?

prasadtalasila commented 1 month ago

please see gitlab.com

nichlaes commented 1 month ago

Can you maybe elaborate on how you think it should be implemented.

Should it clone all the files to the local_path? Do we need a extra env variable with token and repo name? Whenever there is a change to a file, it should commit?

What is the overall goal of the feature? Just so I know what the implementation should solve.

prasadtalasila commented 1 month ago

The scope of this issue is to just include MODE='git' in the .env file. We will deal with the token and repo name in the future PRs.

Including git mode will require adding scaffolding in the existing code base to support this git mode. The goal is to just have scaffolding now and add the actual git functionality later.

We used to have gitlab mode in libms wherein the gitlab is queried to fetch the files. This gitlab mode became non-functional due to upgrade of gitlab GraphQL API. The PR #435 has removed the gitlab mode. The changes made in that PR can show the scaffolding needed. Please use as an inspiration only; the design can perhaps be improved.

prasadtalasila commented 1 month ago

The libms-gitlab-code commit contains the example code scaffolding for gitlab mode. We need similar one for git mode.

nichlaes commented 1 month ago

I should have pushed the necessary code now. Should I also update the docs/markdown files?

prasadtalasila commented 1 month ago

Thanks for the update. The code structure looks similar to the one we had for gitlab mode. Please think about the design suggestion made on this discussion page. I am hoping that it would result in modular code. We can have the design discussion on the discussion page and only check the code implementation on this page.

In addition, please fix the failing tests and add tests for the git mode code as well. Thanks.

prasadtalasila commented 1 month ago

@nichlaes This example provides a template for moving the MODE-based object creation from FilesServiceFactory class to files.module.ts. This move helps avoiding creating redundant objects (for example, creating LocalFileService object when using git mode).