allow to set -diff-state-before option in config (with diff_state_before)
parent
5e69180699
commit
7913d4873f
|
@ -23,6 +23,7 @@ type Config struct {
|
|||
ExpireTilesZoom int `json:"expiretiles_zoom"`
|
||||
ReplicationUrl string `json:"replication_url"`
|
||||
ReplicationInterval MinutesInterval `json:"replication_interval"`
|
||||
DiffStateBefore MinutesInterval `json:"diff_state_before"`
|
||||
}
|
||||
|
||||
type Schemas struct {
|
||||
|
@ -57,6 +58,7 @@ type _BaseOptions struct {
|
|||
ExpireTilesZoom int
|
||||
ReplicationUrl string
|
||||
ReplicationInterval time.Duration
|
||||
DiffStateBefore time.Duration
|
||||
}
|
||||
|
||||
func (o *_BaseOptions) updateFromConfig() error {
|
||||
|
@ -140,6 +142,10 @@ func (o *_BaseOptions) updateFromConfig() error {
|
|||
o.DiffDir = conf.DiffDir
|
||||
}
|
||||
}
|
||||
|
||||
if conf.DiffStateBefore.Duration != 0 && o.DiffStateBefore == 2*time.Hour {
|
||||
o.DiffStateBefore = conf.DiffStateBefore.Duration
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -164,7 +170,6 @@ type _ImportOptions struct {
|
|||
DeployProduction bool
|
||||
RevertDeploy bool
|
||||
RemoveBackup bool
|
||||
DiffStateBefore time.Duration
|
||||
}
|
||||
|
||||
var BaseOptions = _BaseOptions{}
|
||||
|
@ -221,7 +226,7 @@ func init() {
|
|||
ImportFlags.BoolVar(&ImportOptions.DeployProduction, "deployproduction", false, "deploy production")
|
||||
ImportFlags.BoolVar(&ImportOptions.RevertDeploy, "revertdeploy", false, "revert deploy to production")
|
||||
ImportFlags.BoolVar(&ImportOptions.RemoveBackup, "removebackup", false, "remove backups from deploy")
|
||||
ImportFlags.DurationVar(&ImportOptions.DiffStateBefore, "diff-state-before", 2*time.Hour, "set initial diff sequence before")
|
||||
ImportFlags.DurationVar(&BaseOptions.DiffStateBefore, "diff-state-before", 2*time.Hour, "set initial diff sequence before")
|
||||
|
||||
DiffFlags.StringVar(&BaseOptions.ExpireTilesDir, "expiretiles-dir", "", "write expire tiles into dir")
|
||||
DiffFlags.IntVar(&BaseOptions.ExpireTilesZoom, "expiretiles-zoom", 14, "write expire tiles in this zoom level")
|
||||
|
|
|
@ -125,7 +125,7 @@ func Import() {
|
|||
osmCache.Close()
|
||||
log.StopStep(step)
|
||||
if config.ImportOptions.Diff {
|
||||
diffstate, err := state.FromPbf(config.ImportOptions.Read, config.ImportOptions.DiffStateBefore)
|
||||
diffstate, err := state.FromPbf(config.ImportOptions.Read, config.BaseOptions.DiffStateBefore)
|
||||
if err != nil {
|
||||
log.Print("error parsing diff state form PBF", err)
|
||||
} else if diffstate != nil {
|
||||
|
|
Loading…
Reference in New Issue