From 21d2375adf68c62feb19f7d5b93adf94337fe82c Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Mon, 16 Feb 2015 00:26:08 +0100 Subject: web: support missing certificate/privatekey config entries --- src/web/main.vala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/web/main.vala') diff --git a/src/web/main.vala b/src/web/main.vala index dd354c5..86caea5 100644 --- a/src/web/main.vala +++ b/src/web/main.vala @@ -21,9 +21,9 @@ string templatedir; public static int main(string[] args) { TlsCertificate? cert = null; - string certificate; - string privatekey; - uint port; + string certificate = ""; + string privatekey = ""; + uint port = 8080; try { db = Bus.get_proxy_sync(BusType.SESSION, "io.mainframe.shopsystem.Database", "/io/mainframe/shopsystem/database"); @@ -31,8 +31,13 @@ public static int main(string[] args) { cfg = Bus.get_proxy_sync(BusType.SESSION, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config"); templatedir = cfg.get_string("WEB", "filepath"); port = cfg.get_integer("WEB", "port"); - certificate = cfg.get_string("WEB", "cert"); - privatekey = cfg.get_string("WEB", "key"); + + try { + certificate = cfg.get_string("WEB", "cert"); + privatekey = cfg.get_string("WEB", "key"); + } catch(KeyFileError e) { + warning("KeyFileError: %s\n", e.message); + } } catch(IOError e) { error("IOError: %s\n", e.message); } catch(KeyFileError e) { -- cgit v1.2.3