Skip to content

Commit

Permalink
dev: Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
KrishnaIyer committed Nov 7, 2023
1 parent 1e5e089 commit 1b8e814
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,16 @@ $ ttn-lw-migrate firefly device --invalidate-keys < device_ids.txt > devices.jso

The Firefly LNS does not strictly enforce device to application relationships.

Setting the `--all` flag will export **all devices that are accessible by the API key** are exported.

The `application` command without the `--all` flag does nothing.
Setting the `--all` flag will export **all devices that are accessible by the API key**. The `application` command without the `--all` flag does nothing.

> Note: Please be cautious while using this command as this might invalidate all the keys of all the devices.
Similarly, to export all devices accessible by the API Key,
To export all devices accessible by the API Key,

```bash
# dry run first, verify that no errors occur
$ ttn-lw-migrate firefly application --all --verbose > devices.json
# export devices
# export all devices
$ ttn-lw-migrate firefly application --all --invalidate-keys > devices.json
```

Expand Down
2 changes: 1 addition & 1 deletion pkg/export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (cfg Config) ExportDev(s source.Source, devID string) error {
return errDevIDExceedsMaxLength.WithAttributes("id", id)
}

if dev.Ids.DeviceId != oldID {
if dev.Ids.DeviceId != oldID && oldID != "" {
if dev.Attributes == nil {
dev.Attributes = make(map[string]string)
}
Expand Down
14 changes: 1 addition & 13 deletions pkg/source/firefly/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,7 @@ type Config struct {
// NewConfig returns a new Firefly configuration.
func NewConfig() *Config {
config := &Config{
flags: &pflag.FlagSet{},
joinEUI: os.Getenv("JOIN_EUI"),
appID: os.Getenv("APP_ID"),
frequencyPlanID: os.Getenv("FREQUENCY_PLAN_ID"),
macVersion: os.Getenv("MAC_VERSION"),
invalidateKeys: (os.Getenv("INVALIDATE_KEYS") == "true"),
all: (os.Getenv("ALL") == "true"),
Config: client.Config{
Host: os.Getenv("FIREFLY_HOST"),
CACertPath: os.Getenv("FIREFLY_CA_CERT_PATH"),
APIKey: os.Getenv("FIREFLY_API_KEY"),
UseHTTP: (os.Getenv("FIREFLY_USE_HTTP") == "true"),
},
flags: &pflag.FlagSet{},
}

config.flags.StringVar(&config.Host,
Expand Down
2 changes: 1 addition & 1 deletion pkg/source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Source interface {
RangeDevices(appID string, f func(s Source, devID string) error) error
// Close cleans up and terminates any open connections.
Close() error
// Iterator returns an iterator for devices.
// Iterator returns an iterator for the source.
Iterator(isApplication bool) iterator.Iterator
}

Expand Down

0 comments on commit 1b8e814

Please sign in to comment.