 ## Check if application can manage docType
 module.exports.checkDocType = (auth, docType, callback) ->
     # Check if application is authenticated
-    if process.env.NODE_ENV is "production" or process.env.NODE_ENV is "test"
+    if productionOrTest
         checkToken auth, (err, isAuthenticated, name) =>
             if isAuthenticated
                 if docType?

## Initialize tokens which contains applications and their tokens
module.exports.init = (callback) ->
    # Read shared token
    if process.env.NODE_ENV is "production" or process.env.NODE_ENV is "test"
        initHomeProxy () ->
            # Add token and permissions for other started applications
            db.view 'application/all', (err, res) ->

## Check if application is proxy
## Useful for register and login requests
module.exports.checkProxyHome = (auth, callback) ->
    if productionOrTest
        if auth isnt "undefined" and auth?
            # Recover username and password in field authorization
            auth = auth.substr(5, auth.length - 1)
