First phase of the refactor of admin complete

11 views
Skip to first unread message

Fraser Scott

unread,
Sep 20, 2015, 6:43:11 PM9/20/15
to pki.io
Hi all

Branch is now merged into development for both admin and core. Things to note:

* pki.io.go has been renamed to main.go to make it more obvious
* main.go just sets a couple of global variables and then sets up the top level mow.cli command
* The next level commands are in runXXX.go files. These parse the parameters etc and call controller functions. They also set up the "Environment"
* The environment is in environment.go and is used to tracked logging, org controller etc.
* Controllers are in xxxcontroller.go files and do validation then interact with core etc.

Still quite a lot to do (i'll create some tickets for most of it):

* Move controllers to core
* Maybe move the environment to core.. or maybe not. If admin and agent have very different environments, it might make more sense to have individual envs and use an interface
* The mow.cli Action functions could ideally be a bit smarter. There is a lot of repetition of code.
* Logging current sucks. Needs more and stuff is done in the wrong place quite a lot leading to duplication. I was thinking at the start and end of a controller function, then above core commands.
* At the moment the controllers are calling fmt.Printf directly for normal output. They should really just return some data and let the runXXX.go files handle the output to the user.
* Finally, there is still a lot of cleaning up to do. Some stuff has been copy/pasted from the old code, so duplication and doing having functions in the right places.

Getting somewhere though :)

Cheers

Fraser Scott

unread,
Sep 20, 2015, 6:47:20 PM9/20/15
to pki.io
Oh yeah, and most of the validations are missing ;)
Reply all
Reply to author
Forward
0 new messages