Extend API for managing various settings

Robert Rauch robert.rauch at gns-systems.de
Fri Sep 11 09:59:32 UTC 2015



Am 09.09.2015 um 23:37 schrieb Mads Kiilerich:
> On 09/09/2015 11:18 PM, Robert Rauch wrote:
>> Am 09.09.2015 um 21:33 schrieb Mads Kiilerich:
>>> An alternative idea could thus perhaps be to do something like
>>> tweaking paster setup-app/setup-db so it also could be used
>>> without zapping the database and extend it to also be able to
>>> set more than just the initial user credentials.
>> Yes. At the end of the day, we need this feature at the CLI
>> level, no matter how it is implemented. What I really don't like
>> about the `paster setup-db` thing is that it wipes the complete
>> database, even if I only want to *change* one of the initial
>> parameters (like admin password etc), or am I mistaken?
> 
> Yes. But that could be changed.
> 
>>> The chicken-and-egg problem could also be handled by
>>> implementing the API you suggest and giving kallithea-api a
>>> mode where it access the controllers and database directly in
>>> the process (assuming it is passed the right .ini file and has
>>> the right permissions to database and filesystems) instead of
>>> calling a web service.
>> This confuses me a bit. If kallithea-api, as you said, accesses
>> the controllers and database directly, which API has to be
>> implemented then? Anyhow, it sounds good! B-)
> 
> There would still need to be a way to pass values when launching
> the command line tool. I consider command line parameters an API
> too ;-)
> 
> Options like --user and --password options are fine when it is
> simple (except for quoting ambiguities), but for more complex
> operations we might want to be able to pass a json file or json on
> stdin (and definitely no password on the command line), veeery
> similar to how json-rpc works.
> 
> I don't know if anybody have examples of how similar applications
> solve the same problem?

I know of Foreman (though it is a Rails application), which provides a
rake target for manipulating Foremans in-database settings. You can
have a look at its help output at http://pastebin.com/czQXj5kX

As you can see, there is the possibility of specifying simple
key/value data types as well complex (nested) hash/array types via JSON.

Robert


More information about the kallithea-general mailing list