akka에서 application.conf 위치

src/main/resources/application.conf



conf 파일에서 변수 가져오는 방법

  protected val configFactory = ConfigFactory.load()

  protected val path: String = configFactory.getString("xxx.yyy")



빌드 명령:

sbt package



빌드된 jar 파일을 play 앱에서 임포트하면 jar 파일 안에 있는 application.conf 파일은 override된다.

Posted by 타다키치
,

-sbt plugin을 사용하는게 쉽다. gradle은 하지 말자. 아래 링크 참조.

https://devcenter.heroku.com/articles/deploying-scala-and-play-applications-with-the-heroku-sbt-plugin

플러그인 버전은 git repo 방문하여 맞는 버전으로 바꾼다.



-자원 사용 시 conf 폴더 밑에 둔다.

빌드하면 conf 폴더가 헤로쿠에서는 /app/target/universal/stage/conf/ 에 존재한다.

이 경로를 운영 conf 파일에서 사용한다.

예:

data{

root="/app/target/universal/stage/conf/xxx/"

}



-play.filters.hosts.allowed는 다음과 같이 .herokuapp.com을 추가한다.

play.filters {

hosts.allowed = [".herokuapp.com"]



-play.filters.cors.allowedOrigins에 

https://morning-bayou-41273.herokuapp.com 와 같이 origin 전체를 추가해준다.







-헤로쿠 서버 들어가기

heroku run bash -a xxx-111

로그 보기

heroku logs -a xxx-111 -n 1500

빌드하기 -  앱 로컬 폴더에서 

sbt stage deployHeroku

Posted by 타다키치
,

개발 환경 파일

application.test.conf


include "application.conf"


data{

root="C:\\xxx\\yyy\\"

fileile=${data.root}"zzz.csv"

}


위와 같이 원래 application.conf 파일 내용을 가져와서 필요한 내용을 오버라이드 한다.

개발 실행 시

sbt "~run -Dconfig.resource=application.test.conf"


와 같이 읽을 설정 파일을 지정함.


Posted by 타다키치
,