Software / code / prosody
Comparison
tools/migration/prosody-migrator.lua @ 11730:9bf8a0607d12
migrator: Use parsed command line flags already parsed by util.startup
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 29 Jul 2021 14:10:56 +0200 |
| parent | 11729:f37cafeb75d6 |
| child | 11731:076ceb405b94 |
comparison
equal
deleted
inserted
replaced
| 11729:f37cafeb75d6 | 11730:9bf8a0607d12 |
|---|---|
| 55 startup.load_libraries(); | 55 startup.load_libraries(); |
| 56 startup.init_http_client(); | 56 startup.init_http_client(); |
| 57 end | 57 end |
| 58 | 58 |
| 59 -- Command-line parsing | 59 -- Command-line parsing |
| 60 local options = {}; | 60 local options = prosody.opts; |
| 61 local i = 1; | |
| 62 while arg[i] do | |
| 63 if arg[i]:sub(1,2) == "--" then | |
| 64 local opt, val = arg[i]:match("([%w-]+)=?(.*)"); | |
| 65 if opt then | |
| 66 options[(opt:sub(3):gsub("%-", "_"))] = #val > 0 and val or true; | |
| 67 end | |
| 68 table.remove(arg, i); | |
| 69 else | |
| 70 i = i + 1; | |
| 71 end | |
| 72 end | |
| 73 | |
| 74 | 61 |
| 75 local envloadfile = require "util.envload".envloadfile; | 62 local envloadfile = require "util.envload".envloadfile; |
| 76 | 63 |
| 77 local config_file = options.config or default_config; | 64 local config_file = options.config or default_config; |
| 78 local from_store = arg[1] or "input"; | 65 local from_store = arg[1] or "input"; |