This commit is contained in:
yoan 2024-08-23 13:22:44 +08:00
parent f394e34861
commit eac571934c
2 changed files with 32 additions and 1 deletions

29
nixpacks.toml Normal file
View File

@ -0,0 +1,29 @@
providers = []
buildImage = 'ghcr.io/railwayapp/nixpacks:ubuntu-1707782610'
[variables]
CGO_ENABLED = '0'
NIXPACKS_METADATA = 'go'
PORT = '8090'
[phases.build]
paths = ['/bin','/usr/local/bin']
dependsOn = [
'install',
'setup',
]
cmds = ['npm --prefix=./ui run build','go build -o out']
cacheDirectories = ['/root/.cache/go-build']
[phases.install]
dependsOn = ['setup']
cmds = ['go mod download',"npm --prefix=./ui ci"]
cacheDirectories = ['/root/.cache/go-build']
[phases.setup]
nixPkgs = ['go','node']
nixOverlays = []
nixpkgsArchive = '1f13eabcd6f5b00fe9de9575ac52c66a0e887ce6'
[start]
cmd = './out serve --http=0.0.0.0:8090 --dir=/data/pb_data '

View File

@ -1,7 +1,9 @@
import PocketBase from "pocketbase"; import PocketBase from "pocketbase";
const apiDomain = import.meta.env.VITE_API_DOMAIN;
console.log(apiDomain);
let pb: PocketBase; let pb: PocketBase;
export const getPb = () => { export const getPb = () => {
if (pb) return pb; if (pb) return pb;
pb = new PocketBase("http://127.0.0.1:8090"); pb = new PocketBase(apiDomain ? apiDomain : "http://127.0.0.1:8090");
return pb; return pb;
}; };