klesh commented on issue #2863:
URL: 
https://github.com/apache/incubator-devlake/issues/2863#issuecomment-1229898221

   Good one, actually, most of us thought about it in the past. The reason we 
didn't do it are listed below:
   1. `Connection` is plugin specific, it may contain different fields with 
different types against different data sources (API, database, TCP, 
MessageQueue), although all our existing connections look alike, it is not 
necessarily true in the future.
   2. And because `Connection` is plugin specific, it makes more sense to let 
plugins implement the API. take `test` for example, each plugin has a similar 
but quite different implementation, in terms of what kind of Authentication 
mechanism or which URL to validate. A totally different implementation would 
appear sooner or later, for example, to connect to a 3rd database directly. So 
implementing Connection API via `interface` is not very extensible for the 
system.
   3. The idea is to handle connection by Convention, that is, we check if a 
plugin implements those  APIs(test/list/create/edit...) if we need to in the 
future.
   
   On the other hand, we provide `connection_helper` to help developers work 
with connections, which could encrypt/decrypt the secret fields when 
storing/loading to/from database, 
https://github.com/apache/incubator-devlake/blob/5b7859c662eef8cbb3f0df5dc8f98501e581d61e/plugins/github/api/connection.go#L138
   
   I'm happy that you asked, feel free to add more context if I misunderstood 
your intention.
   😃


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to