{"_id":"55e13854c13a5a0d00880e89","category":{"_id":"55e1391926f51b0d009b1778","pages":["55fa45b2aba81f0d00a115de"],"project":"55df3f6386ae7f0d00db4ca2","version":"55df3f6486ae7f0d00db4ca5","__v":1,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-29T04:46:17.687Z","from_sync":false,"order":1,"slug":"configuration","title":"Configuration"},"version":{"_id":"55df3f6486ae7f0d00db4ca5","__v":7,"project":"55df3f6386ae7f0d00db4ca2","createdAt":"2015-08-27T16:48:36.339Z","releaseDate":"2015-08-27T16:48:36.339Z","categories":["55df3f6486ae7f0d00db4ca6","55e1376cd052580d0038c9b9","55e1391926f51b0d009b1778","55e1d40a7d91840d008249ea","55e1d6e27d91840d008249eb","55e20132d052580d0038ca67","55fe3726473f380d000b268a"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"55df3f52ddfb40170061cf96","project":"55df3f6386ae7f0d00db4ca2","__v":33,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-29T04:43:00.794Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important Notice\",\n  \"body\": \"Basic configuration is required for yaas to function correctly.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Configure Authority\"\n}\n[/block]\nyaas support user-configurable authorization, currently these authorization method is avaliable\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Authority Type\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"none\",\n    \"0-1\": \"none is system built-in for no authorization. Not recommended to set this as global authorization method\",\n    \"1-0\": \"local\",\n    \"h-2\": \"Support\",\n    \"0-2\": \"native support\",\n    \"1-2\": \"native support\",\n    \"1-1\": \"Basic API key and user role authorization\",\n    \"2-0\": \"reject\",\n    \"2-1\": \"used for authorization fail-safe, but can be used as well\",\n    \"2-2\": \"native support\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nin the `./src/config` folder, you can find the file `config.js`, there is a object defined as `auth` looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"auth: {\\n        type: 'local',\\n        keys: {\\n            c9cba3d805ff526866d27b5504005766: {\\n                roles: [\\n                    'bucket:list',\\n                    'bucket:upload',\\n                    'file:list',\\n                    'file:get',\\n                    'version:list'\\n                ]\\n            }\\n        },\\n        overwrites: {\\n            'file:get': 'none',\\n            'version:list': 'none',\\n            'file:list': 'none',\\n            'bucket:list': 'none',\\n            'generator:lorem': 'none',\\n            'generator:json': 'none',\\n            'generator:xml': 'none'\\n        }\\n    }\",\n      \"language\": \"javascript\",\n      \"name\": \"auth-config\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"type\",\n    \"0-1\": \"string\",\n    \"0-2\": \"the authority type which will be set globally.\",\n    \"1-0\": \"keys\",\n    \"1-1\": \"object\",\n    \"1-2\": \"for local authorization, this will include all the API keys in this object as key and their roles as a string array\",\n    \"3-0\": \"overwrites\",\n    \"3-1\": \"object\",\n    \"3-2\": \"used when you want to overwrite a role so it uses a totally different authentication method\",\n    \"2-0\": \"keys.roles\",\n    \"2-1\": \"array\",\n    \"2-2\": \"all the roles authorized for this key\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\nThe example above set the global authentication level to `local` and only one API keys is defined `c9cba3d805ff526866d27b5504005766`, this API keys have access to all the roles in yaas. In addition, `file:get` and `version:list` roles have overwrite authentication method `none` means these action will be allowed without authentication.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important Notice\",\n  \"body\": \"Please do not set yaas to use `none` as global authentication method. Instead, use `local` and overwrite the ones you want to set public to `none`\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Configure port\"\n}\n[/block]\nin the `./src/config` folder, you can find the file `config.js`, there is a part ob the file defined as `server` looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"server: {\\n        port:       3939,\\n        port_ssl:   33939\\n}\\n//\\tport can also be set from environment variables\\nPORT_SSL = 39393\\nPORT = 3939\",\n      \"language\": \"javascript\",\n      \"name\": \"server-config\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"property name\",\n    \"h-1\": \"description\",\n    \"h-2\": \"default\",\n    \"0-2\": \"3939\",\n    \"0-0\": \"port\",\n    \"0-1\": \"the port number for HTTP server\",\n    \"1-0\": \"port_ssl\",\n    \"1-1\": \"the port number for HTTPS server\",\n    \"1-2\": \"39393\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nPlease change `port` to the port you want your server to listen to for HTTP and HTTPS\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Configure file save path\"\n}\n[/block]\nin the `./src/config` folder, you can find the file `config.js`, there is a `storage` object defined after `server`\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"storage: {\\n            dest: 'storage/',\\n            processed: 'processed/',\\n            database:   'db/',\\n            relative: true\\n}\\n// File path can also be set from environment variable\\nDATABASE_PATH = db/\\nDEST_PATH = dest/\\nPROCESSES_PATH = processes/\\nPATH_RELATIVE = true\",\n      \"language\": \"javascript\",\n      \"name\": \"server-config\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"property name\",\n    \"h-1\": \"description\",\n    \"h-2\": \"default\",\n    \"0-0\": \"dest\",\n    \"0-1\": \"the folder to store all the uploaded files\",\n    \"0-2\": \"storage/\",\n    \"1-0\": \"processed\",\n    \"1-1\": \"the folder to store all the processed files\",\n    \"1-2\": \"processed/\",\n    \"2-0\": \"database\",\n    \"2-1\": \"the folder to store the database\",\n    \"2-2\": \"db/\",\n    \"3-0\": \"relative\",\n    \"3-1\": \"is the file path specified relative?\",\n    \"3-2\": \"true\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important Notice\",\n  \"body\": \"Please don't use one folder for all the paths, I have separated them for a reason.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Configure Redis\"\n}\n[/block]\nyaas use redis as a quick storage for managing background jobs. Currently, redis is not optional and is a requirement to run yaas.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"redis: {\\n        port: 6379,\\n        host: '127.0.0.1'\\n}\\n//\\tRedis server informaion\\nREDIS_PORT_6379_TCP_ADDR = 127.0.0.1\\nREDIS_PORT_6379_TCP_PORT = 6379\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"This page will include everything you need to know to configure yaas to your liking","slug":"configuration","type":"basic","title":"Basic Configuration"}

Basic Configuration

This page will include everything you need to know to configure yaas to your liking

[block:callout] { "type": "warning", "title": "Important Notice", "body": "Basic configuration is required for yaas to function correctly." } [/block] [block:api-header] { "type": "basic", "title": "1. Configure Authority" } [/block] yaas support user-configurable authorization, currently these authorization method is avaliable [block:parameters] { "data": { "h-0": "Authority Type", "h-1": "Description", "0-0": "none", "0-1": "none is system built-in for no authorization. Not recommended to set this as global authorization method", "1-0": "local", "h-2": "Support", "0-2": "native support", "1-2": "native support", "1-1": "Basic API key and user role authorization", "2-0": "reject", "2-1": "used for authorization fail-safe, but can be used as well", "2-2": "native support" }, "cols": 3, "rows": 3 } [/block] in the `./src/config` folder, you can find the file `config.js`, there is a object defined as `auth` looks like this: [block:code] { "codes": [ { "code": "auth: {\n type: 'local',\n keys: {\n c9cba3d805ff526866d27b5504005766: {\n roles: [\n 'bucket:list',\n 'bucket:upload',\n 'file:list',\n 'file:get',\n 'version:list'\n ]\n }\n },\n overwrites: {\n 'file:get': 'none',\n 'version:list': 'none',\n 'file:list': 'none',\n 'bucket:list': 'none',\n 'generator:lorem': 'none',\n 'generator:json': 'none',\n 'generator:xml': 'none'\n }\n }", "language": "javascript", "name": "auth-config" } ] } [/block] [block:parameters] { "data": { "h-0": "Key", "h-1": "Type", "h-2": "Description", "0-0": "type", "0-1": "string", "0-2": "the authority type which will be set globally.", "1-0": "keys", "1-1": "object", "1-2": "for local authorization, this will include all the API keys in this object as key and their roles as a string array", "3-0": "overwrites", "3-1": "object", "3-2": "used when you want to overwrite a role so it uses a totally different authentication method", "2-0": "keys.roles", "2-1": "array", "2-2": "all the roles authorized for this key" }, "cols": 3, "rows": 4 } [/block] The example above set the global authentication level to `local` and only one API keys is defined `c9cba3d805ff526866d27b5504005766`, this API keys have access to all the roles in yaas. In addition, `file:get` and `version:list` roles have overwrite authentication method `none` means these action will be allowed without authentication. [block:callout] { "type": "warning", "title": "Important Notice", "body": "Please do not set yaas to use `none` as global authentication method. Instead, use `local` and overwrite the ones you want to set public to `none`" } [/block] [block:api-header] { "type": "basic", "title": "2. Configure port" } [/block] in the `./src/config` folder, you can find the file `config.js`, there is a part ob the file defined as `server` looks like this: [block:code] { "codes": [ { "code": "server: {\n port: 3939,\n port_ssl: 33939\n}\n//\tport can also be set from environment variables\nPORT_SSL = 39393\nPORT = 3939", "language": "javascript", "name": "server-config" } ] } [/block] [block:parameters] { "data": { "h-0": "property name", "h-1": "description", "h-2": "default", "0-2": "3939", "0-0": "port", "0-1": "the port number for HTTP server", "1-0": "port_ssl", "1-1": "the port number for HTTPS server", "1-2": "39393" }, "cols": 3, "rows": 2 } [/block] Please change `port` to the port you want your server to listen to for HTTP and HTTPS [block:api-header] { "type": "basic", "title": "3. Configure file save path" } [/block] in the `./src/config` folder, you can find the file `config.js`, there is a `storage` object defined after `server` [block:code] { "codes": [ { "code": "storage: {\n dest: 'storage/',\n processed: 'processed/',\n database: 'db/',\n relative: true\n}\n// File path can also be set from environment variable\nDATABASE_PATH = db/\nDEST_PATH = dest/\nPROCESSES_PATH = processes/\nPATH_RELATIVE = true", "language": "javascript", "name": "server-config" } ] } [/block] [block:parameters] { "data": { "h-0": "property name", "h-1": "description", "h-2": "default", "0-0": "dest", "0-1": "the folder to store all the uploaded files", "0-2": "storage/", "1-0": "processed", "1-1": "the folder to store all the processed files", "1-2": "processed/", "2-0": "database", "2-1": "the folder to store the database", "2-2": "db/", "3-0": "relative", "3-1": "is the file path specified relative?", "3-2": "true" }, "cols": 3, "rows": 4 } [/block] [block:callout] { "type": "warning", "title": "Important Notice", "body": "Please don't use one folder for all the paths, I have separated them for a reason." } [/block] [block:api-header] { "type": "basic", "title": "4. Configure Redis" } [/block] yaas use redis as a quick storage for managing background jobs. Currently, redis is not optional and is a requirement to run yaas. [block:code] { "codes": [ { "code": "redis: {\n port: 6379,\n host: '127.0.0.1'\n}\n//\tRedis server informaion\nREDIS_PORT_6379_TCP_ADDR = 127.0.0.1\nREDIS_PORT_6379_TCP_PORT = 6379", "language": "javascript" } ] } [/block]