Skip to content

Commit

Permalink
Rename address to url (micro#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
asim authored Nov 13, 2020
1 parent e369086 commit 2b534c5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 37 deletions.
4 changes: 2 additions & 2 deletions blog/feeds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ micro new feeds


```
micro feeds new --name="az" --address=http://a16z.com/feed/
micro feeds new --name="a16z" --url=http://a16z.com/feed/
```

```
Expand Down Expand Up @@ -53,4 +53,4 @@ Run the service

```
micro run .
```
```
1 change: 1 addition & 0 deletions blog/feeds/generate.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
package main

//go:generate make proto
8 changes: 4 additions & 4 deletions blog/feeds/handler/crawl.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ func (e *Feeds) fetchAll() {
return
}
for _, feed := range fs {
log.Infof("Fetching address %v", feed.Address)
fd, err := rss.Fetch(feed.Address)
log.Infof("Fetching address %v", feed.Url)
fd, err := rss.Fetch(feed.Url)
if err != nil {
log.Errorf("Error fetching address %v: %v", feed.Address, err)
log.Errorf("Error fetching address %v: %v", feed.Url, err)
continue
}
domain := getDomain(feed.Address)
domain := getDomain(feed.Url)

for _, item := range fd.Items {
id := fmt.Sprintf("%x", md5.Sum([]byte(item.ID)))
Expand Down
4 changes: 2 additions & 2 deletions blog/feeds/handler/feeds.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ func (e *Feeds) crawl() {
func (e *Feeds) New(ctx context.Context, req *feeds.NewRequest, rsp *feeds.NewResponse) error {
log.Info("Received Feeds.New request")
e.feeds.Save(feeds.Feed{
Name: req.Name,
Address: req.Address,
Name: req.Name,
Url: req.Url,
})
return nil
}
50 changes: 24 additions & 26 deletions blog/feeds/proto/feeds.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions blog/feeds/proto/feeds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ service Feeds {
message Feed {
// rss feed name
string name = 1;
// rss feed address
string address = 2;
// rss feed url
string url = 2;
}

message Entry {
Expand All @@ -26,7 +26,7 @@ message Entry {

message NewRequest {
string name = 1;
string address = 2;
string url = 2;
}

message NewResponse {
Expand Down

0 comments on commit 2b534c5

Please sign in to comment.