Git commit author in Project mode with external authentication

Hi

This is my first post so I would like to use this opportunity to express gratitude to the developers and to the community!

Current Setup:
We run node-red on a server with multiple users that create and edit flows from time to time.
We use the Projects feature with remote origin.
We are using Node-red instance with custom tailored Firebase Authentication. Based on the httpAdminMiddleware function that checks JWT token etc. this part is working fine.

But the git commits are all authored by the same user. As set in "User Settings" -> "Git Config".

Requirement: To have a changes "blame log" a user's username or email to be added to each commit

git does have an option to do it through the --author option to the commit command and we have the user's username and email as a header in the request

but how to get one to another ?

right now we did a hack in the

.../node-red/node-red/blob/master/packages/node_modules/%40node-red/runtime/lib/storage/localfilesystem/projects/git/index.js

we added

 if(args[0]==="commit"){
        args.push("--author");
        args.push("globalEmailOverride <"+globalEmailOverride+">");

and we set globalEmailOverride with another hack...

but is there a better way?

The code picks up the username/email settings of the user who is logged in - assuming they have set them in the node-red settings dialog within the editor. The values are stored in the ~/.node-red/.config.json file against their login username.

There is no mechanism to dynamically set those values through the authentication setup, so today you would need to do some sort of hack.

It would be interesting to explore how some of the user configuration could be set more dynamically as part of the login process. But as you are using a middleware to do the auth, does that mean you don't have adminAuth configured at all? So as far as the editor is concerned, there are no individual users? If so, that would make it harder to formalise something here.

Certainly open to discuss how this could be improved.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.