rayhunter icon indicating copy to clipboard operation
rayhunter copied to clipboard

Use a non-example config file, if it exists

Open simonft opened this issue 7 months ago • 18 comments

What problem does this feature solve or what does it enhance?

Right now the deploy code uses config.toml.example, which is checked into git. If you want to make changes to the config while developing you have to either modify the example file or the deploy code, and then be careful not to commit those changes to git.

Proposed Solution

The deploy code should probably use config.toml if it exists, falling back to config.toml.example if it doesn't. Then config.toml can be added to .gitignore.

Alternatives Considered

The defaults could also be added to config.rs, and then config.toml.example could be ignored by the code, which is probably more "correct". But then the defaults in code would need to be kept in sync with the example config.

simonft avatar Jun 21 '25 21:06 simonft

This should be simple enough I'll try to submit a pull request in the next few days if nobody objects.

simonft avatar Jun 21 '25 21:06 simonft

yes please. however i'd also add --reset-config flag that forcibly overwrites it.

untitaker avatar Jun 21 '25 21:06 untitaker

What program would that be an argument to? I think the installer is already overwriting the version on the devices every time, but I assume you mean a flag to replace config.toml with config.toml.example?

simonft avatar Jun 21 '25 22:06 simonft

oh nevermind. i didn't read your proposal carefully. i was thinking of something else.

with #351 there will be a way to change the config graphically. in that scenario i would like the installer not to overwrite the existing config on the device either. so we'd need to change the installer for that too.

i think what you propose is fine adding too.

untitaker avatar Jun 21 '25 22:06 untitaker

we should probably just have a installer update orbic and installer update tplink command that just updates and skips all the rooting steps and also doesn't upload a new config.toml file, but the question then becomes how we handle config changes.

cooperq avatar Jun 24 '25 17:06 cooperq

I think we can have ./installer orbic --keep-config and ./installer tplink --keep-config and it just skips that one file copy. i would like to still overwrite the config by default just so that users have a way to un-break their config if it is corrupted.

analogously we can have ./installer orbic --config-file=myconfig.toml -- might be a bit more explicit than discovering the config.toml in cwd and silently using that. wdyt

untitaker avatar Jun 24 '25 17:06 untitaker

I think we should have an update argument too though that skips all the rooting stuff which is not necessary for just an update.

cooperq avatar Jun 24 '25 17:06 cooperq

my concern is that we have multiple flows that are drifting apart, for unclear benefit (install speed? we can probably make the installer faster in a bunch of ways...)

untitaker avatar Jun 24 '25 17:06 untitaker

my concern is that we have multiple flows that are drifting apart, for unclear benefit (install speed? we can probably make the installer faster in a bunch of ways...)

You mean for each device? I'm not sure how we get around that.

gaykitty avatar Jun 26 '25 22:06 gaykitty

@gaykitty no, i mean having a separate install flow for "first install" vs "upgrade". I think it'd just be more fragmentation..

untitaker avatar Jun 26 '25 22:06 untitaker

Since rayhunter will generate a default config if one isn't present, do we even need the installer to load a default config?

gaykitty avatar Jun 26 '25 23:06 gaykitty

The new ability to set config though the web interface is great! I searched though issues before filing this but not PRs.

I'm assuming the web config editing is meant more for user-focused settings than developer focused ones, and that's why e.g. the dummy analyzer isn't there?

simonft avatar Jun 27 '25 16:06 simonft

yeah, there was some discussion on the pr and it seemed like a footgun to put it there. the port setting too, because then we'd have to handle redirecting to the new page from the UI.

untitaker avatar Jun 27 '25 17:06 untitaker

I still think an --upgrade option to the installer that skips rooting and skips uploading the config file is the best solution here

cooperq avatar Jul 16 '25 22:07 cooperq

Makes sense to me.

gaykitty avatar Jul 16 '25 23:07 gaykitty

@simonft You offered to work on this: If you'd like to add in an --upgrade option to the installer, go for it!

oopsbagel avatar Jul 23 '25 22:07 oopsbagel

OK great. I'll hopefully be able to do some work on this in the coming week.

simonft avatar Jul 28 '25 16:07 simonft

Well, "coming week" was optimistic. I think I'm going to wait until #542 settles to move forward on this, since the two sets of changes will probably bump into each other and this one is probably going to be a lot simpler with an abstraction over the device installers.

simonft avatar Aug 20 '25 14:08 simonft