codeoverflow-org / nodecg-io

A NodeCG-bundle which implements Social Media API's in the NodeCG framework
https://nodecg.io
MIT License
108 stars 26 forks source link

Provide a way for automatic login during development #12

Closed hlxid closed 4 years ago

hlxid commented 4 years ago

Description

During development the step of entering the password can get pretty annoying. In ChatOverflow we had an cli parameter that could be passed with a password which was used to automatically login. We should have a similar system, either with cli parameters or environment variables.

A problem is that the framework doesn't know when all services are loaded and the PersistenceManager requires that all services have registered them selfs. Either we use a timeout like one second after initial loading or we find a way to know when nodecg has finished loading all bundles.

Obviously other bundles could get the password that is passed to the framework, but this is a feature for development only, same as the one in ChatOverflow.

References

CO cli login flag

hlxid commented 4 years ago

Maybe we can use the same way I did it in the GUI, altough it is a bit hacky: https://github.com/codeoverflow-org/nodecg-io/blob/b7348e7da96ca24bdbc8505d261abf8793c79f3f/nodecg-io-core/dashboard/authentication.ts#L13-L17 If there is some cleaner way that is prefered, but at least it is better as a timeout which might fail if it is too short.