Skip to content

Commit

Permalink
feat: 环境变量加载ACCESS_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
c0dedance committed Dec 30, 2023
1 parent 22db548 commit bdafd40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# 填入你的ACCESS_TOKEN 并保存为.env.local
VITE_ACCESS_TOKEN=YOUR_ACCESS_TOKEN
4 changes: 2 additions & 2 deletions docs/rpress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export default defineConfig({
// root: '.',
include: ['./**/*.{md,mdx}'],
server: {
ask: '/ask',
upload: '/upload',
ask: 'https://dkb2jv5y9f.us.aircode.run/ask',
upload: 'https://dkb2jv5y9f.us.aircode.run/upload',
},
}
})
8 changes: 3 additions & 5 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ cli
try {
root = path.resolve(root)
const config = await resolveConfig(root, 'build', 'production')
// load env
const { VITE_ACCESS_TOKEN: accessToken } = loadEnv(
'production',
process.cwd()
)
// load env 支持.env文件、环境变量
const { VITE_ACCESS_TOKEN: accessToken = process.env.ACCESS_TOKEN } =
loadEnv('production', process.cwd())

await upload({
root,
Expand Down

0 comments on commit bdafd40

Please sign in to comment.