comparison src/luan/host/https.luan @ 1716:b82767112d8e

add String.regex
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 24 Jul 2022 23:43:03 -0600
parents 570f3d483a31
children f8eba0442956
comparison
equal deleted inserted replaced
1715:ad44e849c60c 1716:b82767112d8e
6 local Io = require "luan:Io.luan" 6 local Io = require "luan:Io.luan"
7 local ip = Io.ip or error() 7 local ip = Io.ip or error()
8 local uri = Io.uri or error() 8 local uri = Io.uri or error()
9 local output_of = Io.output_of or error() 9 local output_of = Io.output_of or error()
10 local String = require "luan:String.luan" 10 local String = require "luan:String.luan"
11 local regex_quote = String.regex_quote or error() 11 local starts_with = String.starts_with or error()
12 local matches = String.matches or error()
13 local Http = require "luan:http/Http.luan" 12 local Http = require "luan:http/Http.luan"
14 local Hosted = require "luan:host/Hosted.luan" 13 local Hosted = require "luan:host/Hosted.luan"
15 local Logging = require "luan:logging/Logging.luan" 14 local Logging = require "luan:logging/Logging.luan"
16 local logger = Logging.logger "https" 15 local logger = Logging.logger "https"
17 16
146 if key_file.exists() or nginx_file.exists() then 145 if key_file.exists() or nginx_file.exists() then
147 changed = true 146 changed = true
148 nginx_file.delete() 147 nginx_file.delete()
149 local_cer_file.delete() 148 local_cer_file.delete()
150 local_ca_file.delete() 149 local_ca_file.delete()
151 local ptn = [[^]]..regex_quote(domain)..[[\.]] 150 local ptn = domain.."."
152 for _, file in ipairs(dir.children()) do 151 for _, file in ipairs(dir.children()) do
153 if matches(file.name(),ptn) then 152 if starts_with(file.name(),ptn) then
154 file.delete() 153 file.delete()
155 end 154 end
156 end 155 end
157 end 156 end
158 end 157 end