Insomnia: Ability to save workspace to a location

Created on 11 Aug 2019  ยท  17Comments  ยท  Source: Kong/insomnia

  • 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

Most helpful comment

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.

All 17 comments

๐Ÿ‘‹ 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.

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.

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.

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

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.

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.

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

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.

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.

actually I'd still like this to be opened

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

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.

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

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

+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

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. ๐Ÿค—

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.

Was this page helpful?
0 / 5 - 0 ratings