From 3c6000621f04c314876a22b6908cbde24ae40f13 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 2 Oct 2013 11:32:55 +0200 Subject: add documentation of the existing functions --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/README.md b/README.md index 64dd756..98668d5 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,64 @@ clients if you do not want to use trocla on the clients itself. If you want to do your own very custom setup, you should look into the other classes. +## Functions + +### trocla + + +Usage: + + trocla(KEY, FORMAT, [optional options]) + +This is the main function you will use. This is similar to a + + trocla create foo FORMAT + +on the cli. This means, that *if* a password for this key and format +exists, it will return this one, otherwise will create one automatically +and return the generated password. So you might want to do something like: + + user{'foobar': + password => trocla('user_foobar','plain') + } + +If you want to pass down encrypted passwords, you might use: + + + user{'foobar': + password => trocla('user_foobar','sha512crypt') + } + +As descriped further in trocla's docs. + +The optional options, can be used to pass options to the format, like +overriding the default length for passwords that are being created: + + user{'foobar': + password => trocla('user_foobar','sha512crypt','length: 32') + } + +### trocla_get + +Usage: + + trocla_get(KEY, FORMAT) + +This will return the value of the passed key and format. If nothing is +found an error will be raised. This is interesting if you want do not +want to autogenerate a password and rather be sure that it's already +existing in trocla's database. + +### trocla_set + +Usage: + + trocla_set(KEY, FORMAT,PASSWORD) + +This will set the passed password for the key/format pair and return it +as well. This is mainly interesting if you want to migrate existing manifests +with plenty of passwords in it to trocla. + ## Other classes ### trocla::config -- cgit v1.2.3