[์ง์] yml ํ๊ฒฝ๋ณ์ env์ ๋ฑ๋กํ๊ธฐ
์ง๊ธ๊น์ง ๋งจ๋ commitํ ๋๋ง๋ค ๋ก์ปฌ์์ yml ๋ณต์ฌํ๊ณ ์ง์ฐ๊ณ commit ํ ๋ค์ ๋ถ์ฌ๋ฃ๊ธฐํ๊ณ ์์๋๋ฐ ํ์์ด ์ข์ ๋ฐฉ๋ฒ์ ์๋ ค์ค์ ์คํํด๋ณด๋ ค๊ณ ํ๋ค!
๋ฐ๋ก env ํ์ผ์ yml์ ํ๊ฒฝ๋ณ์ ๊ฐ์ ๋ฑ๋กํด๋๋ ๋ฒ์ด๋ค.
๋ก์ปฌ
- resource/properties/env.properties ์์ฑ ํ ์๋ ๊ตฌ์กฐ๋ก ์ค์ ํ์ผ ์์
- propertyConfig ํ์ผ ์์ฑ
package swmaestro.spaceodyssey.weddingmate.global.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
@Configuration
@PropertySources({
@PropertySource("classpath:properties/env.properties") // env.properties ํ์ผ ์์ค ๋ฑ๋ก
})
public class PropertyConfig {
}
๋ก์ปฌ์์ ์ฐ๊ฒฐ ํ์ธ ํ env.properties์ propertyConfig๋ .gitignore์ ๋ฑ๋ก
๊ฐ๋ฐ์๋ฒ
ํด๋น env ํ์ผ์ github secret ENV ๋ณ์์ ๋ฃ๊ธฐ
์ถ์ฒ
[SpringBoot] ํ๊ฒฝ ๋ณ์ ํ์ผ ์ฌ์ฉํ๊ธฐ
์๋ ํ์ธ์. J4J์ ๋๋ค. ์ด๋ฒ ํฌ์คํ ์ ํ๊ฒฝ ๋ณ์ ํ์ผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ ์ด๋ณด๋ ์๊ฐ์ ๊ฐ์ ธ๋ณด๋ ค๊ณ ํฉ๋๋ค. ์ฌ์ฉ ๋ฐฉ๋ฒ [ 1. ๋ณ์ ํ์ผ ์์ฑ ] src/main/resources ๊ฒฝ๋ก์ properties๋ผ๋ ํด๋๋ฅผ ์์ฑ
jforj.tistory.com
์ด ์ข์ ๊ฑธ ์ง๊ธ ์์๋ค๋...๋ฆฌํฉํ ๋ง ํ๊ณ ์๋ ํ์ ํ์๋คํํ ๋ ์ ๋ฌํด์ค์ผ์ง!!!