Mercurial Hosting > freedit
comparison src/lib/Config.luan @ 18:94e26bffd4fb
UI work
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Mon, 11 Jul 2022 12:14:05 -0600 |
| parents | fc2383eb48a9 |
| children |
comparison
equal
deleted
inserted
replaced
| 17:a602a5735a37 | 18:94e26bffd4fb |
|---|---|
| 13 | 13 |
| 14 local doc = Db.get_document("type:config") | 14 local doc = Db.get_document("type:config") |
| 15 Config.text = doc and doc.config or Config.default_text | 15 Config.text = doc and doc.config or Config.default_text |
| 16 | 16 |
| 17 function Config.set(text) | 17 function Config.set(text) |
| 18 local doc = Db.get_document("type:config") or {type="config"} | 18 Db.run_in_transaction( function() |
| 19 doc.config = text | 19 local doc = Db.get_document("type:config") or {type="config"} |
| 20 Db.save(doc) | 20 doc.config = text |
| 21 Db.save(doc) | |
| 22 end ) | |
| 21 end | 23 end |
| 22 | 24 |
| 23 return Config | 25 return Config |
