Page MenuHomeMusing Studio

load global config from file
Open, Thinking, LowPublic

Description

I'm hoping to have the tool load the configuration files, when present, from the configured directory on application execution.

The main thing I'm trying to figure out at the moment is how to access that data from within the shared code, in sub packages.

  • There is no easy way I can see so far, that allows accessing arbitrary data from the cli framework.

Event Timeline

robjloranger changed the task status from Open to Thinking.May 28 2019, 10:49 PM
robjloranger triaged this task as Low priority.
robjloranger created this task.
robjloranger created this object with visibility "Public (No Login Required)".
robjloranger created this object with edit policy "All Users".

it might not be as important as I think, the tool really only runs through once so as long as they share the loading and parsing code there is no need to load it at the start. just on demand and only if needed

I found a way to pass information down the stack with the cli.Context.

one is with App.ExtraInfo which is a function that returns a map of string/string. The function can be anything that returns the map, so could parse other config info into it.

TODO: is this WF-only? Or both CLIs?

Will be both, I'm thinking of loading the config at the start of each command and pass it down through calls. Some command paths may call LoadConfig 2 or 3 times which is a waste.

I think maybe both LoadUser and LoadConfig should be called and create some combined data structure for AppConfig which would be passed around during a command execution.

robjloranger moved this task from Soon to Next Up on the WriteFreely CLI board.

This will likely be a moderate refactor.