Skip to content

Commit

Permalink
fixup! Add flag to disable DB update
Browse files Browse the repository at this point in the history
  • Loading branch information
afjoseph committed Mar 21, 2024
1 parent 1383f28 commit f5b9e5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ Download the rz-pm binary for your system on the [latest release page](https://g
| **GithubCI** | [![Go](https://github.com/rizinorg/rz-pm/actions/workflows/go.yml/badge.svg)](https://github.com/rizinorg/rz-pm/actions/workflows/go.yml) |

# Available packages
The official database is available [here](https://github.com/rizinorg/rz-pm-db).

The official database is available [here](https://github.com/rizinorg/rz-pm-db). You can change the repo by supplying a custom `RZPM_DB_REPO_URL` environment flag like this:

$ RZPM_DB_REPO_URL=https://github.com/bunnyfoofoo/my-custom-rz-pm-db rz-pm install rz-custom-plugin

Furthermore, to aid with debugging, you can disable auto-updating the `rz-pm-db` upon each command execution by adding `-should-update-db=false` flag, like this:

$ rz-pm -should-update-db=false install rz-custom-plugin

## Package example

Expand Down
13 changes: 12 additions & 1 deletion pkg/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/fs"
"io/ioutil"
"log"
"os"
"os/exec"
"path/filepath"
Expand All @@ -25,7 +26,17 @@ func SiteDir() string {
return filepath.Join(xdg.DataHome, "rz-pm", "site")
}

const RZPM_DB_REPO_URL = "https://github.com/rizinorg/rz-pm-db"
var RZPM_DB_REPO_URL string

func init() {
dbURL := os.Getenv("RZPM_DB_REPO_URL")
if dbURL != "" {
log.Printf("Using custom rz-pm-db Git repo: %s\n", dbURL)
RZPM_DB_REPO_URL = dbURL
} else {
RZPM_DB_REPO_URL = "https://github.com/rizinorg/rz-pm-db"
}
}

type Site interface {
ListAvailablePackages() ([]Package, error)
Expand Down

0 comments on commit f5b9e5a

Please sign in to comment.