inovex / CalendarSync

Stateless CLI tool to sync calendars across different calendaring systems.
MIT License
93 stars 10 forks source link

clean flag should also work if the source is not accessible / does not exist anymore #112

Open lukasjarosch opened 6 months ago

lukasjarosch commented 6 months ago

I've recently switched customers and my access to the source calendar was revoked. Unfortunately the--clean flag does not work without a source calendar / without access to a source calendar.

I would expect that if I remove the source key from my config / the source calendar is not accessible and run Calendarsync with the clean flag, that all events from said source are removed.

alxndr13 commented 6 months ago

How would calendarsync know, from which source events are to clean in the sink if you're removing the information about the source? We could do something opinionated and remove all of the events which have calendarsync metadata in them, but this is not something i would prefer.

but I agree with you, the --clean flag should also work without access to the source calendar. (but we probably need the info which source calendar it was)

lukasjarosch commented 6 months ago

Given there are multiple sources, and I remove one source. All sink events should have SourceID metadata and the ones with a SourceID which doesn't exist need to be removed. Wouldn't that be sufficient?

alxndr13 commented 6 months ago

That should be sufficient. But since we only support one source per config right now, i don't see how this should work. Given the circumstances you describe (once we support multiple sources per config), that approach may be an option.

lukasjarosch commented 6 months ago

Wouldn't my idea still work? I assume it would be even easier. Just remove all events with Calendarsync metadata. Or am I missing something?

alxndr13 commented 5 months ago

Should be that easy, yes.

As of now the CleanUp func is part of the controller and the controller needs a sink and a source to be initialized.

Will see if i can create a new subcommand for this, which would leave the source initialization out of the equation.