Code Monkey home page Code Monkey logo

nuxt_blogs's Introduction

Hi there 👋

  • 🌱, Life can be changed.
  • 👯, Proactively seek help.
  • 💬, Take action.

nuxt_blogs's People

Contributors

echo9z avatar

Watchers

 avatar  avatar

nuxt_blogs's Issues

请教部署的问题

想请教的是Drone CI 打包部署时候的.env配置的问题。
假设env文件里有敏感信息,不能写到仓库里。所以也不能写到pipeline里。 nuxt推荐使用.env配置变量。我看到你的项目里也是用了。请问你遇到了这个问题吗,如何处理的?

比如我的env里有四个变量,需要根据不同的环境来配置,假设只有两个环境,本地开发和线上,本地是两个数字,线上是三个数字:

a=11
b=22
c=33
d=44

目前我了解到的解决方案如下:

  1. 先去drone ci的web端,在secret里添加一个条目,比如这里叫build-env
  2. 在对应的value里填写上面的四个值:
a=111
b=222
c=333
d=444
  1. 在pieline里添加以下代码:
# .drone.yml
kind: pipeline
name: default

steps:
- name: copy-env
  image: alpine:latest
  environment:
    BUILD_ENV:
      from_secret: build-env
  commands:
  - echo -n $BUILD_ENV > .env
- name: build
  image: node:18-alpine
  commands:
  - corepack enable && corepack prepare pnpm@latest --activate
  - pnpm -v
  - pnpm install
  - pnpm build
  - pnpm preview

这样每次得到的env文件好像是个空的,项目运行的时候,获取不到需要的env变量。
请问你能给一点意见或者建议吗?谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.