3
일부 프로젝트 구성의 YAML 파일이 있는데 코드 유지 보수를 간단하게하기 위해 코드 일부를 다시 사용하고자합니다. 그래서 앵커를 사용하여이를 시도하지만 이전 노드를 무시하고 싶습니다. 그게 가능하니? 다음은 YAML 노드 덮어 쓰기
내 예입니다default: &default
output: &default_output
make_video: true
take_screenshot: true
browser: &default_browser
type: :chrome
width: 1024
height: 1280
logger: &default_logger
level: TRACE
output_type: :file
chrome_browser: &chrome_browser
<<: *default
browser:
type: :chrome
user_agent: user_agent_string_for_chrome
firefox_browser: &firefox_browser
<<: *default
browser:
type: :firefox
user_agent: user_agent_string_for_firefox
좋아, 그래서 이것은 첫 번째 부분입니다 :이 할 수 있습니까? firefox_browser가 "type"을 재정의합니까?
이제 두 번째 부분 :
profile:
<<: *default
staging:
europe:
url: www.staging-europe-site.com
chrome:
<<: *browser_chrome
firefox:
<<: *browser_firefox
america:
url: www.staging-america-site.com
chrome:
<<: &browser_chrome
firefox:
<<: &browser_firefox
live:
europe:
url: www.europe-site.com
chrome:
<<: &browser_chrome
firefox:
<<: &browser_firefox
america:
url: www.america-site.com
chrome:
<<: &browser_chrome
firefox:
<<: &browser_firefox
내가는 YAML을 읽은 후, 내가 할 수있는 것을 위해 그런 일을 할 수있는 :
profile_yaml['staging.europe.chrome']
내가 모든 구성을 얻을?