Aller au contenu principal

config

return extenso config

CONFIG

NAME

config - return extenso config

SYNOPSIS

config()

DESCRIPTION

This variable contains extenso configuration:

  • filename : filename of the configuration
  • project : project name
  • root : root (/usr/local/website/sednove)
  • site : staging or html
  • dbuser
  • dbhost
  • dbpass
  • dbname
  • source : execution by http or sncode
  • post_max : Contains maximum number of byte for post data.

Starting at version 5.54 config also return the following information:

  • version : current version of Sncode 
  • timeout : timeout for a request in second
  • log : directory where information about the request is saved and a lot more. Slow everything.
  • module: associative array of module name for each external module containing:
    • init : init function
    • library : library loaded
    • version : version of the module
    • child_init : child init function

Starting at version 5.67

  • variable : variable is use to pass a json string. The string is evaluated (unstringnify) when config is called the first time.

PARAMETERS

none

RETURN

Returns a context variable containing extenso config info.

EXAMPLE

This function config() is returning the information in the following config file, usually located at the folder that puts all the websites:
#
# Project name
# 

Project : "v5"                                             # Name of project
WebsiteRoot : "/usr/local/website/v5"                      # Root of project ; No ending slash
Locale : "fr_CA.utf8"                                      # Locale used in program
Postmax : "64000"                                          # Maximum number of bytes for a post

#
# Database connection
#

Database default {
	Host : "localhost"                                     # Server name
	Name : "v5"
	User : "v5"
	Password : "v5"
	charset : "utf8"
}

# Timeout for a request
Timeout : "5"

#
# List of modules
#

Module curl {
	Library : "/usr/local/lib/libsncurl.so"
	Init : "sncurl_init"
}

Module exif {
	Library : "/usr/local/lib/libsnexif.so"
	Init : "snexif_init"
}

Module geoip {
	Library : "/usr/local/lib/libsngeoip.so"
	Init : "sngeoip_init"
}

Module geoip2 {
	Library : "/usr/local/lib/libsngeoip2.so"
	Init : "sngeoip2_init"
}

Module gd {
	Library : "/usr/local/lib/libsngd.so"
	Init : "sngd_init"
}

Module hash {
	Library : "/usr/local/lib/libsndbhash.so"
	Init : "sndbhash_init"
}
Module xml {
	Library : "/usr/local/lib/libsnxml.so"
	Init : "snxml_init"
}

Module exemple {
	Library : "/usr/local/lib/libsnexemple.so"
	Init : "snexemple_init"
	ChildInit : "snexemple_child_init"
	vara : "valuea"
	varb : "valueb"
}

#
# Preload these functions
#

Preload : "/usr/local/website/v5/extenso/functions/preload.snc"
#Preload : ""

#
# Default error file
#

Error : "/usr/local/website/v5/html/tests/error.snc"

#
# Index file
# 

Index : ".snc,.sn,index.sn"

#
# Log directory if needed
# 

#Log : "/extenso_logs/"
#

#
# variable json style
#
variable { 
	"x" : 5,
	"y" : [1,2,3]
}
# Do no esc cgidata
esc_cgidata : "false"

SEE ALSO

{{ include("includes/variables.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

1.1 2016-04-01 laplante@sednove.com support for version and module starting at version 5.54

1.2 2016-07-27 laplante@sednove.com Add support for variable

1.3 2017-11-17 laplante@sednove.com source is suppoted since version 5.90

Edit

© 2024 extenso Inc. All rights reserved.