Compare commits
No commits in common. "dev" and "main" have entirely different histories.
@ -1,7 +1,4 @@
|
|||||||
FROM testhub.szjixun.cn:9043/public/self-alpine
|
FROM testhub.szjixun.cn:9043/public/self-alpine
|
||||||
ENV TZ Asia/Shanghai
|
ENV TZ Asia/Shanghai
|
||||||
ENV MODE_ENV prod
|
COPY build/app /root
|
||||||
WORKDIR /root
|
ENTRYPOINT [ "chmod 777 /root/app && /root/app" ]
|
||||||
COPY build/app ./
|
|
||||||
COPY conf/ ./conf
|
|
||||||
CMD ["sh", "-c", "./app"]
|
|
@ -1,7 +1,4 @@
|
|||||||
FROM testhub.szjixun.cn:9043/public/self-alpine
|
FROM testhub.szjixun.cn:9043/public/self-alpine
|
||||||
ENV TZ Asia/Shanghai
|
ENV TZ Asia/Shanghai
|
||||||
ENV MODE_ENV dev
|
COPY build/app /root
|
||||||
WORKDIR /root
|
ENTRYPOINT [ "chmod 777 /root/app && /root/app" ]
|
||||||
COPY build/app ./
|
|
||||||
COPY conf/ ./conf
|
|
||||||
CMD ["sh", "-c", "./app"]
|
|
12
cmd/app.go
12
cmd/app.go
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
@ -13,17 +12,8 @@ import (
|
|||||||
"github.com/filebrowser/filebrowser/v2/service"
|
"github.com/filebrowser/filebrowser/v2/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
if os.Getenv("MODE_ENV") != "" {
|
|
||||||
os.Setenv(constant.ConfigFileEnvKey, fmt.Sprintf("./conf/%s/%s", os.Getenv("MODE_ENV"), "dubbogo.yaml"))
|
|
||||||
service.BasePath = "./data"
|
|
||||||
} else {
|
|
||||||
os.Setenv(constant.ConfigFileEnvKey, "../conf/dubbogo.yaml")
|
|
||||||
service.BasePath = "../"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
os.Setenv(constant.ConfigFileEnvKey, "../conf/dubbogo.yaml")
|
||||||
config.SetProviderService(&service.FilesProvider{})
|
config.SetProviderService(&service.FilesProvider{})
|
||||||
if err := config.Load(); err != nil {
|
if err := config.Load(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
0
conf/conf.ini
Normal file
0
conf/conf.ini
Normal file
@ -1,14 +0,0 @@
|
|||||||
dubbo:
|
|
||||||
registries:
|
|
||||||
demoZK:
|
|
||||||
protocol: zookeeper
|
|
||||||
address: 172.16.100.93:2181
|
|
||||||
protocols:
|
|
||||||
triple:
|
|
||||||
name: tri
|
|
||||||
port: 20027
|
|
||||||
provider:
|
|
||||||
services:
|
|
||||||
FileProvider:
|
|
||||||
protocol: tri
|
|
||||||
interface: files.File # must be compatible with grpc or dubbo-java
|
|
@ -1,14 +0,0 @@
|
|||||||
dubbo:
|
|
||||||
registries:
|
|
||||||
demoZK:
|
|
||||||
protocol: zookeeper
|
|
||||||
address: zookeeper:2181
|
|
||||||
protocols:
|
|
||||||
triple:
|
|
||||||
name: tri
|
|
||||||
port: 20027
|
|
||||||
provider:
|
|
||||||
services:
|
|
||||||
FileProvider:
|
|
||||||
protocol: tri
|
|
||||||
interface: files.File # must be compatible with grpc or dubbo-java
|
|
@ -31,7 +31,7 @@ type FilesProvider struct {
|
|||||||
filesApi.UnimplementedFileServer
|
filesApi.UnimplementedFileServer
|
||||||
}
|
}
|
||||||
|
|
||||||
var BasePath = "../"
|
const BASE_PATH = "../"
|
||||||
|
|
||||||
var imgSvc = img.New(4) // 图片预览可用协程数
|
var imgSvc = img.New(4) // 图片预览可用协程数
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ func newFileDownloadWriter(stream filesApi.File_DirDownloadServer) *fileDownload
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getFs(userSpacePath string) afero.Fs {
|
func getFs(userSpacePath string) afero.Fs {
|
||||||
bashAbs, _ := filepath.Abs(BasePath)
|
bashAbs, _ := filepath.Abs(BASE_PATH)
|
||||||
|
|
||||||
if !strings.HasPrefix(userSpacePath, "/") {
|
if !strings.HasPrefix(userSpacePath, "/") {
|
||||||
userSpacePath = "/" + userSpacePath
|
userSpacePath = "/" + userSpacePath
|
||||||
|
Loading…
Reference in New Issue
Block a user