Now that we have the salts, we’ll want to use them to establish the keys.config:
def write_keys_config(wordpress_salts: dict): with open('wordpress/.ebextensions/keys.config', 'w') as keys_config: with open('.ebextensions/keys.config', 'r') as keys_template: keys_config.write(keys_template.read().format(wordpress_salts['AUTH_KEY'], wordpress_salts['SECURE_AUTH_KEY'], wordpress_salts['LOGGED_IN_KEY'], wordpress_salts['NONCE_KEY'], wordpress_salts['AUTH_SALT'], wordpress_salts['SECURE_AUTH_SALT'], wordpress_salts['LOGGED_IN_SALT'], wordpress_salts['NONCE_SALT']).replace('`', '\`'))
And then in main:
print("Salting keys.config ...") write_keys_config(get_wordpress_salts())