pressflow / 7

Pressflow 7
GNU General Public License v2.0
329 stars 79 forks source link

What is $_SERVER['PRESSFLOW_SETTINGS'] ? #94

Closed sdubois closed 2 years ago

sdubois commented 3 years ago

Hello,

While looking through the source code for Pressflow 7, I noticed that bootstrap.inc is checking for a server variable $_SERVER['PRESSFLOW_SETTINGS'] and attempting to load settings from there such as database credentials. This seems to be an alternative to specifying credentials in settings.php

I was not able to find any documentation on this on the Pressflow wiki. What format should this data be in? How can this data be set on the server ?

Thanks

generalredneck commented 3 years ago

@sdubois, Infact it is. Pantheon uses it pretty strong. You can see the use for it pretty simply in a diff. $_SERVER['PRESSFLOW_SETTINGS'] is a json string that contains the conf and databases object properties... so it would look something like:

{
  databases: {
    default: {
      default: {
        driver: 'mysql',
        prefix: '',
        database: 'pantheon',
        username: 'pantheon',
        password: 'pantheon',
        host: 'database',
        port: 3306,
      },
    },
  },
  conf: {
    'pressflow_smart_start': true,
    'pantheon_binding': 'lando',
    'pantheon_site_uuid': options.id,
    'pantheon_environment': 'lando',
    'pantheon_tier': 'lando',
    'pantheon_index_host': PANTHEON_INDEX_HOST,
    'pantheon_index_port': PANTHEON_INDEX_PORT,
    'redis_client_host': PANTHEON_CACHE_HOST,
    'redis_client_port': PANTHEON_CACHE_PORT,
    'redis_client_password': PANTHEON_CACHE_PASSWORD,
    'file_public_path': 'sites/default/files',
    'file_private_path': 'sites/default/files/private',
    'file_directory_path': 'sites/default/files',
    'file_temporary_path': '/tmp',
    'file_directory_temp': '/tmp',
    'css_gzip_compression': false,
    'js_gzip_compression': false,
    'page_compression': false,
  }
}
generalredneck commented 3 years ago

How can this data be set on the server ?

if you are running apache, using SetEnv PRESSFLOW_SETTINGS "JSON_STRING" in your .htaccess is one straight forward way.