TheThingsNetwork / lorawan-stack-migrate

Migrate devices from other LoRaWAN Network Servers to The Things Stack
Apache License 2.0
8 stars 3 forks source link

TTS needs application id set in two places #54

Closed jpmeijers closed 1 year ago

jpmeijers commented 1 year ago

Summary

If I want to migrate devices from TTS, I need to set the application ID both as an environment variable as well as provide it on the command line as an argument. This duplication feels redundant, and makes using the migration tool more difficult. It would be better if the environment variable is not required.

Why do we need this?

Make using the tool easier.

What is already there? What do you see now?

Application ID both as a environment variable, as well as command line argument.

export TTNV3_APP_ID="my-app-id"

ttn-lw-migrate application --source ttnv3 "my-app-id" --dry-run --verbose

What is missing? What do you want to see?

Less duplication

Environment

$ ttn-lw-migrate version
Migrate from other LoRaWAN network servers to The Things Stack: ttn-lw-migrate
Version:             0.9.0-rc0
Build date:          2022-09-14T06:55:16Z
Git commit:          a291155
Go version:          go1.18.5
OS/Arch:             linux/amd64

How do you propose to implement this?

Only use the application ID provided as a command line argument.

How do you propose to test this?

...

Can you do this yourself and submit a Pull Request?

...

jpmeijers commented 1 year ago

If I use a different Application ID as env var, than provided on the command line, I get this error:

$ export TTNV3_APP_ID="rugged-edge"
$ ttn-lw-migrate application --source ttnv3 "jpm-rak10701" --dry-run
Error: error:go.thethings.network/lorawan-stack-migrate/cmd:export (export device `eui-db72be9c06fa6328`)
error:go.thethings.network/lorawan-stack-migrate/cmd:export (export device `eui-db72be9c06fa6328`)
    device_id=eui-db72be9c06fa6328
    correlation_id=25f6d13f18f048cfb694279072e31423
--- error:pkg/identityserver/store:end_device_not_found (end device with id `eui-db72be9c06fa6328` not found in application with id `rugged-edge`)
    application_id=rugged-edge
    device_id=eui-db72be9c06fa6328
    correlation_id=42b3451016dc40379f9cc32866fc6f1d