builder/common: extract out decode config
builder/*: extract to common the config decoding