1.0.1 • Published 6 months ago

payload-storage-github v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

GitHub Storage for Payload

This package provides a way to use the GitHub REST API to store files with Payload.

Installation

pnpm add payload-storage-github

Usage

  • Configure the collections object to specify which collections should use the GitHub Storage adapter. The slug must match one of your existing collection slugs.
  • When enabled, this package will automatically set disableLocalStorage to true for each collection.
import { githubStorage } from 'payload-github-storage'
import { Media } from './collections/Media'
import { MediaWithPrefix } from './collections/MediaWithPrefix'

export default buildConfig({
  collections: [Media, MediaWithPrefix],
  plugins: [
    githubStorage({
      collections: {
        [mediaSlug]: true,
        [mediaWithPrefixSlug]: {
          prefix: '/media',
        },
      },

      owner: process.env.GITHUB_REPOSITORY_OWNER,
      repo: process.env.GITHUB_REPOSITORY_NAME,
      branch: process.env.GITHUB_REPOSITORY_BRANCH,

      options: {
        auth: process.env.GITHUB_ACCESS_TOKEN,
      },
    }),
  ],
})

Configuration Options

OptionDescriptionDefault
enabledWhether or not to enable the plugintrue
collectionsCollections to apply the storage to
ownerThe name of the repository owner (GitHub username or organization)
repoThe repository name
branchWhich branch to upload/read files"main"
optionsOctokit client configuration. See Docs
1.0.1

6 months ago

1.0.0

7 months ago

0.1.19

7 months ago

0.1.17

7 months ago

0.1.16

7 months ago

0.1.15

7 months ago

0.1.14

7 months ago

0.1.13

7 months ago

0.1.12

7 months ago

0.1.11

7 months ago

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago