From 4d83fd4238e177d9327c760a5386bc53f25dedbb Mon Sep 17 00:00:00 2001 From: Michael Li Date: Mon, 17 Feb 2020 22:48:24 +0800 Subject: Use go-bindata to embed `public` and `templates` files into binary (#5920) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixed private repositories are hidden in the organization's view * use go-bindata integrate public and templates files to gogs binary * optimize Dockerfile don't COPY public and templates files * use kevinburke's go-bindata to generate assets code * reset develepment as default run mode in configure file * optimize generated assets code relayout and help function * fixed code format * Update conf/app.ini * assets: add LICENSE headers * Some housekeeping * assets/public: simplify code logic * assets/templates: simplify code logic * cmd/web: more concise variable names * Minor changes * Add custom public and templates support back Co-authored-by: ᴜɴᴋɴᴡᴏɴ --- internal/db/repo.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/db/repo.go') diff --git a/internal/db/repo.go b/internal/db/repo.go index 3195e5dd..6d3c8689 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -30,10 +30,11 @@ import ( "github.com/gogs/git-module" api "github.com/gogs/go-gogs-client" + "gogs.io/gogs/internal/assets/conf" "gogs.io/gogs/internal/avatar" - "gogs.io/gogs/internal/bindata" "gogs.io/gogs/internal/db/errors" "gogs.io/gogs/internal/markup" + "gogs.io/gogs/internal/osutil" "gogs.io/gogs/internal/process" "gogs.io/gogs/internal/setting" "gogs.io/gogs/internal/sync" @@ -56,7 +57,7 @@ func LoadRepoConfig() { types := []string{"gitignore", "license", "readme", "label"} typeFiles := make([][]string, 4) for i, t := range types { - files, err := bindata.AssetDir("conf/" + t) + files, err := conf.AssetDir("conf/" + t) if err != nil { log.Fatal(4, "Fail to get %s files: %v", t, err) } @@ -929,10 +930,10 @@ func getRepoInitFile(tp, name string) ([]byte, error) { // Use custom file when available. customPath := path.Join(setting.CustomPath, relPath) - if com.IsFile(customPath) { + if osutil.IsFile(customPath) { return ioutil.ReadFile(customPath) } - return bindata.Asset(relPath) + return conf.Asset(relPath) } func prepareRepoCommit(repo *Repository, tmpDir, repoPath string, opts CreateRepoOptions) error { -- cgit v1.2.3