Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

properties와 환경변수는 단톡 공지 참고

application.properties

spring.application.name=Rehappy

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/rehappy
spring.datasource.username=root
spring.datasource.password=0000

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect

frontend 용 환경변수 만드는 법

1. 환경 변수 파일 생성
frontend 폴더(node_modules, public, src와 같은 위치)에서 .env 파일 만들기

2. 저장
.env 파일에 들어가서    REACT_APP_원하는이름=내API키    이런 형식으로 저장
예) REACT_APP_GOOGLE_PLACES_API_KEY = 내API키

3. 사용
사용할 때는 평소 변수 생성하듯이 쓰면 되는데, 내가 설정한 API 변수명 앞에 process.env.를 붙여서
const apiKey = process.env.REACT_APP_GOOGLE_PLACES_API_KEY;
이렇게 사용하면 된다.

주의할 점

  • .env 파일은 그냥 File 형식으로, .env 옆에 붙은 아이콘이 메모장마냥 엄청 평범하게 생겼다. 그거 맞으니 당황 xx
  • 저장과 사용은 꼭 형식을 지켜 사용해야 함.
  • .env 파일에 키 저장할 때 따옴표 사용 x, 문장 끝에 ; 사용 x. 그냥 줄바꿈

    이렇게 하면 push 할 때 마다 키를 지우지 않아도 됩니다~
    헷갈리면 물어바요!
  • About

    No description, website, or topics provided.

    Resources

    Stars

    0 stars

    Watchers

    1 watching

    Forks

    Releases

    Packages

    Used by

    Contributors

    Languages