sparse-intern-71089
01/19/2021, 4:26 PMgentle-diamond-70147
01/19/2021, 4:31 PMfamous-twilight-87777
01/19/2021, 4:35 PMfamous-twilight-87777
01/19/2021, 4:35 PMlet private_key_encoded = "";
service_account_key.privateKey.apply(k => private_key_encoded = k);
famous-twilight-87777
01/19/2021, 4:36 PMgentle-diamond-70147
01/19/2021, 5:02 PMprivate_key_encoded
? I can help you get it working and explain what's happening if I can see more of your code.famous-twilight-87777
01/19/2021, 5:04 PMconst user_data_template = readFileSync('./cloud-config').toString();
const vars_map = {
private_key_json: private_key_encoded
}
const compiled_user_data = _.template(user_data_template);
const rendered_user_data = compiled_user_data(vars_map);
famous-twilight-87777
01/19/2021, 5:04 PMfamous-twilight-87777
01/19/2021, 5:05 PMlittle-cartoon-10569
01/19/2021, 10:22 PMreadFileSync
code also has to be inside the same apply()
block. As written, that code is (potentially) being run before the apply()
block. private_key_encoded
is not updated by the time it is being used.