Skip to content

Instantly share code, notes, and snippets.

@grimrose
Last active November 5, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grimrose/6d6539a48f1abaf94f21 to your computer and use it in GitHub Desktop.
Save grimrose/6d6539a48f1abaf94f21 to your computer and use it in GitHub Desktop.

やりたいこと

liquidのパラメータを外部から設定したい

やりたいこと:

$ embulk config.yml.liquid -X HOGE_ENV=staging

現状:

$ export HOGE_ENV=staging; embulk config.yml.liquid
path_prefix: "/tmp/{{ env.HOGE_ENV | default: "development" }}/csv/sample_"
# 例えば以下の様な使い方が出来たらいいなぁ
path_prefix: "/tmp/{{ options[:system_config][HOGE_ENV] | default: "development" }}/csv/sample_"
in:
type: file
{% include 'config_include' %}
decoders:
- {type: gzip}
parser:
charset: UTF-8
newline: CRLF
type: csv
delimiter: ','
quote: '"'
trim_if_not_quoted: false
skip_header_lines: 1
allow_extra_columns: false
allow_optional_columns: false
columns:
- {name: id, type: long}
- {name: account, type: long}
- {name: time, type: timestamp, format: '%Y-%m-%d %H:%M:%S'}
- {name: purchase, type: timestamp, format: '%Y%m%d'}
- {name: comment, type: string}
out: {type: stdout}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment