Hashtag Framework Configuration

Introduction

A hashtag.conf file in the Web root can be used to configure all core services of the Hashtag Framework.   JSON is used to define the key value settings.

Key Values

Configuration values are made available in the global config bucket, and are used to configure core services, such as SQL databases and many 3rd party Vendor APIs.

  • namespace
  • application_name
  • database_host — PHP PDO SQL database source.   To learn more, visit php.net
  • database_username
  • database_password
  • memcache_host
  • memcache_port
  • request_map_strip_prefix
  • request_map_prefix
  • base_dir
  • web_basedir
  • private_upload_dir
  • public_upload_dir
  • email_from
  • debug_enabled — Set to true, then add ?debug=t to the URL to inspect
  • suppress_http_503_headers
  • markup_disable_db
  • markup_disable_include
  • markup_include_from_db_query
  • markup_disable_deliver
  • markup_catch_redirect
  • google_client_id
  • google_client_secret
  • google_client_auth_file
  • google_scopes
  • google_cloud_project_id
  • google_cloud_storage_bucket_name
  • google_token_message
  • google_token_button_template — [google_oauth_url]
  • google_token_footer
  • google_sheet_namespace
  • s3_access_key_id
  • s3_secret_key
  • s3_bucket_private
  • s3_bucket_public
  • elasticache_config_endpoint
  • elasticache_config_port
  • ses_smtp_host — AWS Simple Email Service
  • ses_smtp_username
  • ses_smtp_password
  • twilio_accountsid
  • twilio_authtoken
  • twilio_source_address
  • openmarket_account_id
  • openmarket_source_ton
  • openmarket_source_address
  • openmarket_password

Isolating Environments

Configuration settings that apply to all environments go in the global bucket.   Domain specific settings are placed in a bucket named as the domain, and overwrite any global settings for the same keys.   See the Example Configuration below.

Example Configuration

This sample hashtag.conf file is for a Web App hosted by Google App Engine, using a Google Cloud SQL database, and includes alternate domain specific settings for a test environment, and a local development environment.    hashtag.conf

{
	"global":
	{
		"database_host": "mysql:unix_socket=/cloudsql/project-id:db;dbname=db;charset=utf8mb4",
		"database_username": "root",
		"database_password": "",
		"google_client_id": "",
		"google_client_secret": "",
		"google_cloud_storage_bucket_name": "",
		"initial_admin_code": ""
	},
	"test.example.com":
	{
		"database_host": "mysql:unix_socket=/cloudsql/test-project-id:db;dbname=db;charset=utf8mb4",
		"google_client_id": "",
		"google_client_secret": ""
	},
	"localhost":
	{
		"database_host": "mysql:host=127.0.0.1;dbname=project-db-name;charset=utf8mb4",
		"database_username": "root",
		"database_password": "root-password",
		"google_client_id": "",
		"google_client_secret": ""
	}
}

Alternate Configuration Methods

To avoid processing the hashtag.conf file with every request, there are a few options.

  • The PHP global variable $_SERVER can be used to set any configuration key value.
    • AWS Elastic Beanstalk enables this method, automatically including RDS credentials.
    • Apache users can add SetEnv commands in the .htaccess file or Apache configuration.
  • The Hashtag Framework Core object can be manually configured in the main.php file.