Skip to content

Commit d17ec3e

Browse files
authored
Merge pull request #8 from onXmaps/michal/geofabrik-replicate
Add support for geofabrik daily
2 parents 09d7386 + c59d53d commit d17ec3e

File tree

8 files changed

+58
-780
lines changed

8 files changed

+58
-780
lines changed

replication/changesets.go

Lines changed: 0 additions & 214 deletions
This file was deleted.

replication/changesets_test.go

Lines changed: 0 additions & 69 deletions
This file was deleted.

replication/datasource.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"time"
77
)
88

9-
// BaseURL defines the default planet server to hit.
10-
const BaseURL = "https://planet.osm.org"
9+
// BaseURL defines the default replication server to hit.
10+
const BaseURL = "https://planet.osm.org/replication/minute"
1111

1212
// Datasource defines context around replication data requests.
1313
type Datasource struct {
@@ -17,36 +17,26 @@ type Datasource struct {
1717

1818
// DefaultDatasource is the Datasource used by the package level convenience functions.
1919
var DefaultDatasource = &Datasource{
20+
BaseURL: BaseURL,
2021
Client: &http.Client{
2122
Timeout: 30 * time.Minute,
2223
},
2324
}
2425

2526
// NewDatasource creates a Datasource using the given client.
26-
func NewDatasource(client *http.Client) *Datasource {
27+
func NewDatasource(baseURL string, client *http.Client) *Datasource {
2728
return &Datasource{
28-
Client: client,
29+
BaseURL: baseURL,
30+
Client: client,
2931
}
3032
}
3133

3234
func (ds Datasource) baseURL() string {
33-
if ds.BaseURL != "" {
34-
return ds.BaseURL
35-
}
36-
37-
return BaseURL
35+
return ds.BaseURL
3836
}
3937

4038
func (ds Datasource) client() *http.Client {
41-
if ds.Client != nil {
42-
return ds.Client
43-
}
44-
45-
if DefaultDatasource.Client != nil {
46-
return DefaultDatasource.Client
47-
}
48-
49-
return http.DefaultClient
39+
return ds.Client
5040
}
5141

5242
// UnexpectedStatusCodeError is return for a non 200 or 404 status code.

0 commit comments

Comments
 (0)