faas-cli icon indicating copy to clipboard operation
faas-cli copied to clipboard

feat: allow URL and local files for Store locations

Open LucasRoesler opened this issue 2 years ago • 0 comments

Description

Enable local files and remote files over HTTP(S) as store locations for the Function and Template stores.

This enables the following commands to work as expected

faas-cli store list --url $HOME/Downloads/functions.json
faas-cli store list --url ~/Downloads/functions.json
faas-cli store list --url https://internal/organization.com/openfaas/functions.json
faas-cli template store list --url $HOME/Downloads/templates.json
faas-cli template store list --url ~/Downloads/templates.json
faas-cli template store list --url
https://internal.organization.com/openfaas/templates.json

Additional locations such as ipfs, blob storage (s3, Google Cloud Storge, etc) and other could also be supported via a small patch to the ReadJSON implementation.

Motivation and Context

  • [x] I have raised an issue to propose this change (required)

Resolves #984

How Has This Been Tested?

Using modified versions of the store files, I was able to list templates and functions from my Downloads folder

$ faas-cli template store list --url $HOME/Downloads/templates.json

NAME       RECOMMENDED DESCRIPTION SOURCE
dockerfile [x]         openfaas    Classic Dockerfile template

$ faas-cli store list --url=$HOME/Downloads/functions.json

FUNCTION AUTHOR   DESCRIPTION
nodeinfo openfaas NodeInfo

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I've read the CONTRIBUTION guide
  • [x] I have signed-off my commits with git commit -s
  • [ ] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

LucasRoesler avatar Oct 29 '23 14:10 LucasRoesler