Mercurial Hosting > luan
comparison src/luan/host/init.luan @ 1611:f67f972bd648
make postgres.luan optional
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 15 May 2021 17:24:07 -0600 |
parents | 219f2b937f2b |
children | cf9dfead83a3 |
comparison
equal
deleted
inserted
replaced
1610:94ea190714dd | 1611:f67f972bd648 |
---|---|
1 local Luan = require "luan:Luan.luan" | 1 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | 2 local error = Luan.error |
3 local do_file = Luan.do_file or error() | 3 local do_file = Luan.do_file or error() |
4 local Package = require "luan:Package.luan" | |
4 local String = require "luan:String.luan" | 5 local String = require "luan:String.luan" |
5 local gsub = String.gsub or error() | 6 local gsub = String.gsub or error() |
6 local Number = require "luan:Number.luan" | 7 local Number = require "luan:Number.luan" |
7 local long = Number.long or error() | 8 local long = Number.long or error() |
8 | 9 |
70 local Sql = require "luan:sql/Sql.luan" | 71 local Sql = require "luan:sql/Sql.luan" |
71 local database = Sql.database or error() | 72 local database = Sql.database or error() |
72 local Logging = require "luan:logging/Logging.luan" | 73 local Logging = require "luan:logging/Logging.luan" |
73 local logger = Logging.logger "init" | 74 local logger = Logging.logger "init" |
74 | 75 |
75 local fn = Luan.load_file("file:postgres.luan") or error() | 76 local pg = Package.load("file:postgres.luan") |
76 local pg = fn() | |
77 | 77 |
78 function Hosted.postgres_spec() | 78 function Hosted.postgres_spec() |
79 if pg == nil then | 79 if pg == false then |
80 return nil | 80 return nil |
81 end | 81 end |
82 local spec = { | 82 local spec = { |
83 class = "org.postgresql.Driver" | 83 class = "org.postgresql.Driver" |
84 url = "jdbc:postgresql://localhost:5432/"..domain | 84 url = "jdbc:postgresql://localhost:5432/"..domain |