Skip to content

Instantly share code, notes, and snippets.

@theodorosploumis
Last active May 31, 2023 16:13
Show Gist options
  • Save theodorosploumis/68b6b2ca68e06c78cdb1566627c5eb29 to your computer and use it in GitHub Desktop.
Save theodorosploumis/68b6b2ca68e06c78cdb1566627c5eb29 to your computer and use it in GitHub Desktop.
{
"hash_salt": "vWSbysR6MKt5TPhxu04S8arFqYzaXC4pEdlRLxjOXTxYp_SibKKQQbvT7UYFH1Lixf8RkpCVvg",
"update_free_access": false,
"container_yamls": [
"\\/app\\/sites\\/default\\/services.yml"
],
"file_scan_ignore_directories": [
"node_modules",
"bower_components"
],
"entity_update_batch_size": 50,
"cache": {
"bins": {
"render": "cache.backend.memory",
"page": "cache.backend.memory",
"dynamic_page_cache": "cache.backend.memory"
}
},
"rebuild_access": true,
"skip_permissions_hardening": true,
"trusted_host_patterns": [
"^.+\\.*\\.lndo\\.site/\\.*$",
"."
],
"file_chmod_directory": 509,
"file_chmod_file": 436,
"config_exclude_modules": [
"devel",
"kint",
"stage_file_proxy",
"reroute_email"
]
}
@theodorosploumis
Copy link
Author

Add this to settings.php

// JSON to Settings experiment
function object_to_array($obj) {
    if(is_object($obj) || is_array($obj)) {
        $ret = (array) $obj;
        foreach($ret as &$item) {
        	$item = object_to_array($item);
        }
        return $ret;
    }
    else {
        return $obj;
    }
}

// Helper: Generate JSON from $settings variable
// $json = json_encode($settings);
// $fp = fopen('results.json', 'w');
// fwrite($fp, $json);
// fclose($fp);

// Use external JSON file to store $settings variable
$gist = 'https://gist.githubusercontent.com/theodorosploumis/';
$online_json = $gist . '68b6b2ca68e06c78cdb1566627c5eb29/raw/073b0df06fa33fae35aca9453e4c2d484ea019d1/settings.php.json';
$online_data = file_get_contents($online_json);
$online_settings = (array) json_decode($online_data);
$online_settings = object_to_array($online_settings);

// Finally, assign the JSON array data to $settings variable
$settings = array_merge($online_settings);

@theodorosploumis
Copy link
Author

In order to convert PHP array to JSON you can use https://wtools.io/convert-php-array-to-json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment