Crafter Social System Administration
This guide covers the basic configuration for Crafter Social, if you need to manage contexts and user generated content you can follow the Crafter Social Admin Console UI guides.
Note
This guide assumes that you have already installed and configured Crafter Profile. For details see Crafter Profile System Administration
All configuration for Crafter Social is managed using a properties file:
CRAFTER_HOME/bin/apache-tomcat/shared/classes/crafter/social/extension/server-config.properties
MongoDB Configuration
Using the following properties you can change the server and database used by Crafter Social. This will allow you to use advanced MongoDB features and also host multiple Crafter Social databases in the same MongoDB server.
Properties prefix: crafter.social.mongodb.
Property |
Default Value |
Description |
---|---|---|
connection.newConnectionStr |
MongoDB URL used for all
connections
|
|
connection.dbName |
craftersocial |
Name of the MongoDB database
|
connection.scriptRunner.withClient |
false |
If enabled a native client will
be used to run all scripts
|
connection.scriptRunner.clientPath |
/usr/local/bin/mongo |
Absolute path of the native
client
|
connection.dbUsername |
None |
Username for MongoDB
authentication
|
connection.dbPassword |
None |
Password for MongoDB
authentication
|
scripts.runOnInit |
true |
If enabled all scripts for
creating the default context,
will run each time the
Crafter Social war is loaded
|
scripts.paths |
List of all MongoDB scripts to
run
|
Crafter Profile Configuration
Using these properties you can control how Crafter Social interacts with Crafter Profile.
Properties prefix: crafter.profile.rest.client.
Property |
Default Value |
Description |
---|---|---|
url.base |
http://localhost:8080/profile |
URL where Crafter Profile is
deployed
|
accessToken.id |
2ba3ac10-c43e-11e3-9c1a-0800200c9a66 |
Access Token included in all
requests made to the Crafter
Profile API
|
Web Configuration
Properties prefix: crafter.social.web.
Property |
Default Value |
Description |
---|---|---|
mapping.dateFormat |
yyyy-MM-dd’T’HH:mm’Z’ |
Pattern used to format all dates
|
maxUpload |
10485760 |
Maximum file size in bytes for attachments
|
defaultSortOrder |
ASC |
Default sort order used for queries
|
User Generated Content Configuration
Properties prefix: crafter.social.ugc.
Property |
Default Value |
Description |
---|---|---|
invalidQueryKeys |
contextId:|$where: |
MongoDB keywords not allowed in the
user provided queries
|
arraySortFields |
flags, votesDown,
votesUp, attachments,
ancestors
|
MongoDB fields allowd to sort query
results
|
virusScanner |
Class implementing the
VirusScanner interface, see Virus Scanner Configuration
|
Notifications Configuration
Using these configurations you can control how Crafter Social handles email notifications.
Properties prefix: studio.social.notification.
Property |
Default Value |
Description |
---|---|---|
dailyCron |
|
CRON Expressions used to control how often each type
of notification is sent.
|
weeklyCron |
|
|
instantCron |
|
|
startDelay |
60 |
Time in seconds to wait after the application is
loaded to start sending notifications
|
instantInterval |
120000 |
Time in milliseconds to wait between each instant
notification is sent
|
disable |
false |
If set to
true notifications will not be sent |
Other Configuration
Properties prefix: studio.social.system.
Property |
Default Value |
Description |
---|---|---|
ugcClass |
Class implementing the
UgcFactory interface, willbe used to create all new user
generated contents
|
|
defaultLocale |
EN
|
Locale used for notification
templates
|
ignoreAnonymousFlagRoles |
SOCIAL_ADMIN,
SOCIAL_SUPERADMIN,
SOCIAL_MODERATOR
|
Roles not taken into account when
adding flags to user generated
content
|
Properties prefix: studio.social.system.profileAgg.
Property |
Default
Value
|
Description |
---|---|---|
cache.ttl |
3600 |
Total time in seconds that objects will be kept in
the cache
|
cache.tti |
1800 |
Time in seconds that objects will be kept in the
cache wihout being used
|
cache.maxElementsInMemory |
250 |
Maximum number of objects kept in memory
by the cache
|
attributesToReturn |
List of fields used by MongoDB queries
|
Properties prefix: studio.social.system.emailConfig.
Property |
Default
Value
|
Description |
---|---|---|
cache.ttl |
3600 |
Total time in seconds that objects will be kept in
the cache
|
cache.tti |
1800 |
Time in seconds that objects will be kept in the
cache wihout being used
|
cache.maxElementsInMemory |
250 |
Maximum number of objects kept in memory
by the cache
|
Properties prefix: studio.social.system.tentanConfig.
Property |
Default
Value
|
Description |
---|---|---|
cache.ttl |
3600 |
Total time in seconds that objects will be kept in
the cache
|
cache.tti |
1800 |
Time in seconds that objects will be kept in the
cache wihout being used
|
cache.maxElementsInMemory |
250 |
Maximum number of objects kept in memory
by the cache
|
Properties prefix: studio.social.system.cors.
Using these properties you can control the Cross-Origin Resource Sharing settings to assure your sites and applications are able to access the Crafter Social API.
Property |
Default Value |
Description |
---|---|---|
disableCORS |
false |
If set to
true CORS headers willnot be added to any response
|
accessControlAllowHeaders |
x-requested-with |
Value for the header
Access-Control-Allow-Headers |
accessControlAllowMethods |
POST,GET,PUT,DELETE |
Value for the header
Access-Control-Allow-Methods |
accessControlMaxAge |
3600 |
Value for the header
Access-Control-Max-Age |
accessControlAllowOrigin |
Value for the header
Access-Control-Allow-Origin |
|
accessControlAllowCredentials |
false |
Value for the header
Access-Control-Allow-Credentials |
Virus Scanner Configuration
Since users of your site or application will be able to upload files into the Crafter Social database
it is recommended to setup an antivirus for additional protection of both the server and the
client machines. By default Crafter Social is configured to use an empty implementation of the
VirusScanner
, in a production environment you should follow these steps to enable it:
Enable ClamAV Virus Scanner
Install ClamAV
Edit the ClamAV configuration file to include the following properties:
1# The values provided are just an example, they are fine for a local test but you should
2# use the appropriate values for production
3
4TCPSocket 3310
5TCPAddr 127.0.0.1
Start the
clamd
daemonAdd the following file:
Note
If you are going to use the default ClamAV values (localhost:3310) the only change needed is the
property studio.social.ugc.virusScanner=org.craftercms.virusscanner.impl.ClamavVirusScannerImpl
.
1<?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
5
6 <bean id="social.ugc.virusScanner" class="org.craftercms.virusscanner.impl.ClamavVirusScannerImpl">
7 <property name="host" value="localhost"/>
8 <property name="port" value="3310"/>
9 <property name="timeout" value="60000"/>
10 </bean>
11
12 </beans>
Reload the Crafter Social WAR file or restart the Tomcat server
Using a Custom Virus Scanner
If you need to use a different antivirus software you can create a class that implements the
org.craftercms.virusscanner.api.VirusScanner
interface. Your custom class should:
Define all configuration needed by the antivirus
Execute the antivirus scan for individual files
Throw a
org.craftercms.virusscanner.impl.VirusScannerException
if any threat is detected
Notes