insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

[FEATURE REQUEST] Ability to save and work on a collection/doc in local file system

Open cyberhck opened this issue 5 years ago β€’ 27 comments

  • Insomnia Version: 6.6.2
  • Operating System: Linux BL7TBH2 4.15.0-46-generic #49~16.04.1-Ubuntu SMP Tue Feb 12 17:45:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux (linux mint)

Details

Hello there, I did try to search through the issues, find anything, so hopefully this isn't duplicate.

I wanted to be able to save and open workspace from any location on our disk. The motivation behind this is that I want to commit this data on my source control and others can use it directly, I know about the teams and sharing, but there another issue, I want to be able to run those requests through CLI on CI system.

Actually saving to a directory on my repository, without a huge single json file would be better, it can use the same dir structure as the app, and each request could be separate file, that way version control would track much better.

Thanks

cyberhck avatar Aug 11 '19 16:08 cyberhck

πŸ‘‹ Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. If you're requesting a feature 🎁, please provide real use cases that would benefit. πŸ‘ͺ

To help make this a smooth process, please be sure you have first read the contributing guidelines.

welcome[bot] avatar Aug 11 '19 16:08 welcome[bot]

Was about to open an issue for this. I have a different use case. We as a team store everything next to our project, so we would love to have the API JSON file there too. Paw supports storing it to a location, so we were able to save the file to our NextCloud and share it with the team. Maybe you could add this too with a lowered priced team sub.

muuvmuuv avatar Aug 22 '19 06:08 muuvmuuv

The local DB files probably won't work very well with VCS but there currently exists an INSOMNIA_DATA_PATH environment variable that can be used to control where local app data is stored. https://github.com/getinsomnia/insomnia/pull/1230

There's also a plugin hook to export the current workspace. It should be possible to write a plugin that exports the current workspace every few seconds to a desired folder.

Saving to the FS with the same folder/request structure as Insomnia uses would require replacing the current local database (NeDB) with a new file-based one so that's likely not an option for now.

gschier avatar Aug 22 '19 06:08 gschier

Sounds like what I wanted @gschier. Where do I add this env var, just in my e.g. .zshrc?

muuvmuuv avatar Aug 22 '19 06:08 muuvmuuv

I'm not sure. You could try it there.

If you need it to be different for different projects than you'd likely be better off setting it when launching it from the command line.

INSOMNIA_DATA_PATH=/my/data/path /path/to/insomnia

I'm not familiar enough with Ubuntu to suggest the best method.

gschier avatar Aug 22 '19 07:08 gschier

Great, thanks! I am on macOS so it is different, this works: INSOMNIA_DATA_PATH=~/Downloads/Data /Applications/Insomnia.app/Contents/MacOS/Insomnia.

Unfortunately this is as you have mentioned the hole Insomnia instance with all settings not only the workspace. Would be great to have something like this in the future. I'll use it like this for now and check out the plugin hooks method.

muuvmuuv avatar Aug 26 '19 07:08 muuvmuuv

So I had a quick look into plugins but none of the hooks seems to work here. There is context.data.export which would work I guess but I can't find a hook that has access to it.

Do you have a reference/link that has more information? I just found https://support.insomnia.rest/article/26-plugins#context.data and https://github.com/getinsomnia/insomnia/blob/develop/packages/insomnia-app/app/plugins/index.js#L174-L219

muuvmuuv avatar Aug 26 '19 07:08 muuvmuuv

Ah right, we might need a new plugin hook for that. It might be good to have an init hook that a plugin could use to do initial setup of things like repeating commands.

gschier avatar Sep 05 '19 16:09 gschier

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 04 '19 17:11 stale[bot]

actually I'd still like this to be opened

cyberhck avatar Nov 06 '19 04:11 cyberhck

So I had a quick look into plugins but none of the hooks seems to work here. There is context.data.export which would work I guess but I can't find a hook that has access to it.

Do you have a reference/link that has more information? I just found https://support.insomnia.rest/article/26-plugins#context.data and https://github.com/getinsomnia/insomnia/blob/develop/packages/insomnia-app/app/plugins/index.js#L174-L219

Insomnia Cancel the API for exporting data?

the context object didn't has a member called data

dingyaguang117 avatar Jan 20 '20 12:01 dingyaguang117

I was really hoping for this feature when I discovered insomnia. Postman won't do this because it goes against their business model.

Honestly it would be fine if the db was committed to the repo (though obviously not ideal), as long as there was decent ui for opening and closing a workspace.

Hell, even just a hotkey to "save" which could just be an export, and open from an exported folder would work.

It's bizarre to me that all the api tools seem to want to sync using teams instead of letting people control their data in vc.

ericwooley avatar Feb 07 '20 22:02 ericwooley

Or have an extension, which is a simple json file or whatever db file insomnia uses, and allow us to double click on it, I really need it on VC because I want to have tests there and run it on ci

cyberhck avatar Feb 08 '20 11:02 cyberhck

+1 to this feature request. Being able to save a workspace in a project's repository would be very valuable.

jj0b avatar Apr 08 '20 21:04 jj0b

+1 to this feature request. It would be nice that each environment had its own save location as I work on different projects each with their own repo

MDornian avatar Oct 08 '20 03:10 MDornian

Hey all, Insomnia Designer does support directly syncing your workspace with a git repository. Specifically for @cyberhck, Unit Tests in Designer also sync to your repository, and you can run them in CI using the companion CLI, Inso - inso run test TestSuite --env Staging.

Git Sync, and the ability to create and run Unit Tests, have not been included in Insomnia Core just yet, but it is entirely possible to migrate across to Designer to make use of these features in a seamless manner.

Please reach out if there is anything I can help to clarify. I know this isn't a direct answer to some of the queries in this issue, but some different workflows are available for keeping a workspace in the same location as a project repository. πŸ€—

develohpanda avatar Oct 08 '20 05:10 develohpanda

It will be nice if we can tell the workspace exporter not to minimize the resulting JSON. This feature (the export/import) is ok for me as it is but having it not minimized will help with diffs. It will also allow to implement a VCS backed workspace even if you have to import/export it manually.

fjfnaranjo-wavelt avatar Oct 30 '20 11:10 fjfnaranjo-wavelt

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 29 '21 19:05 stale[bot]

+1 for this feature request. @filfreire any possibility of this happening in the near future?

VultureJD avatar Jan 13 '23 00:01 VultureJD

Im supporting this as well, my usecase is just simply to avoid accidentally wiping all your workspaces. I usually have all my developing stuff on a separate harddrive, so that way i am able to avoid losing all my data when my OS HDD dies. Also, all developing stuff is organized on a single hard drive.

So yes, reinstalled windows, and guess what happened, i didn't think of Insomnia storing all my stuff in AppData. So many Tools tend to force Users into their own specific save Folders, it starts becoming a Mess. And for many tools forcing Users to do this, it becomes easy to overlook one of them.

Chicane90 avatar Feb 13 '23 08:02 Chicane90

seriously? You're storing your code in a external hard drive? what if it's lost or damaged? Why aren't you using git and github?

cyberhck avatar Feb 13 '23 09:02 cyberhck

Why do we have to be tied into using Inso’s git tool? It would be much better and easier to just allow for Inso spec files to be saved to a file location that is source controlled through another tool. Why re-invent the wheel?

VultureJD avatar Feb 13 '23 09:02 VultureJD

Why re-invent the wheel?

I guess money?

cyberhck avatar Feb 13 '23 10:02 cyberhck

seriously? You're storing your code in a external hard drive? what if it's lost or damaged? Why aren't you using git and github?

No, not external Hard Drive, a separate HardDrive in my Computer, and there isnt only code on this drive, (local Servers, Tools, local maven repos etc.), basically all the stuff needed for developing. And ofc, the code itself also gets pushed to git.

Chicane90 avatar Feb 13 '23 10:02 Chicane90

@cyberhck For example, I am storing files in a local filesystem that's committed to Git outside of Insomnia management. Since Insomnia can't work with file references from the apispec, I'm managing the spec separately then use a pipeline to merge into one so that insomnia can use them.

andrei-dascalu avatar Sep 13 '23 12:09 andrei-dascalu

This problem deserves more attention but I am not sure whether allowing external storage of existing data file solves the issue completely. For instance, currently Insomnia stores data in (on Windows) %AppData%/Insomnia as various JSON-like DB files, e.g. insomnia.Request.db. Such files are not friendly for version control.

chaojian-zhang avatar Nov 13 '23 16:11 chaojian-zhang