...
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env -S v -n -w -parallel-cc -enable-globals run
|
||||
#!/usr/bin/env -S v -n -cg -w -parallel-cc -enable-globals run
|
||||
// #!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
|
||||
|
||||
import os
|
||||
|
||||
@@ -49,7 +49,7 @@ pub mut:
|
||||
// GitRepoConfig holds repository-specific configuration options.
|
||||
pub struct GitRepoConfig {
|
||||
pub mut:
|
||||
remote_check_period int = 3600 * 24 * 3 // Seconds to wait between remote checks (0 = check every time), default 3 days
|
||||
remote_check_period int = 3600 * 24 * 7 // Seconds to wait between remote checks (0 = check every time), default 7 days
|
||||
}
|
||||
|
||||
// just some initialization mechanism
|
||||
|
||||
@@ -83,7 +83,8 @@ pub fn (mut repo GitRepo) need_pull() !bool {
|
||||
// Therefore we need to pull
|
||||
return true
|
||||
}
|
||||
return error('Failed to check merge-base: ${err}')
|
||||
return true
|
||||
// return error('Failed to check merge-base: ${err}')
|
||||
}
|
||||
// If we get here, the remote commit is in our history
|
||||
// Therefore we don't need to pull
|
||||
|
||||
@@ -13,6 +13,9 @@ pub fn (mut repo GitRepo) status_update(args StatusUpdateArgs) ! {
|
||||
// Check current time vs last check, if needed (check period) then load
|
||||
repo.cache_get() or { return error('Failed to get cache for repo ${repo.name}: ${err}') } // Ensure we have the situation from redis
|
||||
repo.init() or { return error('Failed to initialize repo ${repo.name}: ${err}') }
|
||||
if 'OFFLINE' !in os.environ() {
|
||||
return
|
||||
}
|
||||
current_time := int(time.now().unix())
|
||||
if args.reload || repo.last_load == 0
|
||||
|| current_time - repo.last_load >= repo.config.remote_check_period {
|
||||
|
||||
@@ -30,7 +30,6 @@ fn obj_init(mycfg_ CaddyServer) !CaddyServer {
|
||||
// user needs to us switch to make sure we get the right object
|
||||
fn configure() ! {
|
||||
mut cfg := get()!
|
||||
|
||||
if !os.exists('/etc/caddy/Caddyfile') {
|
||||
// set the default caddyfile
|
||||
configure_examples(path: cfg.path)!
|
||||
|
||||
Reference in New Issue
Block a user