fix vc generator

pull/3170/head
Alexander Medvednikov 2019-12-21 05:25:28 +03:00
parent 61bfecfa09
commit ecd46d381c
3 changed files with 9 additions and 6 deletions

View File

@ -128,8 +128,7 @@ fn main() {
// webhook server mode // webhook server mode
if flag_options.serve { if flag_options.serve {
app := WebhookServer{ gen_vc: new_gen_vc(flag_options) } vweb.run<WebhookServer>(flag_options.port)
vweb.run(mut app, flag_options.port)
} }
// cmd mode // cmd mode
else { else {
@ -154,10 +153,12 @@ fn new_gen_vc(flag_options FlagOptions) &GenVC {
// WebhookServer init // WebhookServer init
pub fn (ws mut WebhookServer) init() { pub fn (ws mut WebhookServer) init() {
mut fp := flag.new_flag_parser(os.args.clone()) mut fp := flag.new_flag_parser(os.args.clone())
flag_options := parse_flags(mut fp) flag_options := parse_flags(mut fp)
ws.gen_vc = new_gen_vc(flag_options) ws.gen_vc = new_gen_vc(flag_options)
ws.gen_vc.init() ws.gen_vc.init()
//ws.gen_vc = new_gen_vc(flag_options)
} }
// gen webhook // gen webhook
@ -171,6 +172,10 @@ pub fn (ws mut WebhookServer) genhook() {
ws.vweb.json('{status: "ok"}') ws.vweb.json('{status: "ok"}')
} }
pub fn (ws &WebhookServer) reset() {
}
// parse flags to FlagOptions struct // parse flags to FlagOptions struct
fn parse_flags(fp mut flag.FlagParser) FlagOptions { fn parse_flags(fp mut flag.FlagParser) FlagOptions {
return FlagOptions{ return FlagOptions{

View File

@ -63,8 +63,7 @@ mut:
} }
fn main() { fn main() {
app := App{} vweb.run<App>(8080)
vweb.run(mut app, 8080)
} }
fn (app mut App) index() { fn (app mut App) index() {

View File

@ -14,8 +14,7 @@ mut:
} }
fn main() { fn main() {
app := App{} vweb.run<App>(8080)
vweb.run(mut app, 8080)
} }
fn (app mut App) index_text() { fn (app mut App) index_text() {