This page will include everything you need to know to configure yaas to your liking
Important Notice
Basic configuration is required for yaas to function correctly.
1. Configure Authority
yaas support user-configurable authorization, currently these authorization method is avaliable
| Authority Type | Description | Support |
|---|---|---|
| none | none is system built-in for no authorization. Not recommended to set this as global authorization method | native support |
| local | Basic API key and user role authorization | native support |
| reject | used for authorization fail-safe, but can be used as well | native support |
in the ./src/config folder, you can find the file config.js, there is a object defined as auth looks like this:
auth: {
type: 'local',
keys: {
c9cba3d805ff526866d27b5504005766: {
roles: [
'bucket:list',
'bucket:upload',
'file:list',
'file:get',
'version:list'
]
}
},
overwrites: {
'file:get': 'none',
'version:list': 'none',
'file:list': 'none',
'bucket:list': 'none',
'generator:lorem': 'none',
'generator:json': 'none',
'generator:xml': 'none'
}
}
| Key | Type | Description |
|---|---|---|
| type | string | the authority type which will be set globally. |
| keys | object | for local authorization, this will include all the API keys in this object as key and their roles as a string array |
| keys.roles | array | all the roles authorized for this key |
| overwrites | object | used when you want to overwrite a role so it uses a totally different authentication method |
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.
Important Notice
Please do not set yaas to use
noneas global authentication method. Instead, uselocaland overwrite the ones you want to set public tonone
2. Configure port
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:
server: {
port: 3939,
port_ssl: 33939
}
// port can also be set from environment variables
PORT_SSL = 39393
PORT = 3939
| property name | description | default |
|---|---|---|
| port | the port number for HTTP server | 3939 |
| port_ssl | the port number for HTTPS server | 39393 |
Please change port to the port you want your server to listen to for HTTP and HTTPS
3. Configure file save path
in the ./src/config folder, you can find the file config.js, there is a storage object defined after server
storage: {
dest: 'storage/',
processed: 'processed/',
database: 'db/',
relative: true
}
// File path can also be set from environment variable
DATABASE_PATH = db/
DEST_PATH = dest/
PROCESSES_PATH = processes/
PATH_RELATIVE = true
| property name | description | default |
|---|---|---|
| dest | the folder to store all the uploaded files | storage/ |
| processed | the folder to store all the processed files | processed/ |
| database | the folder to store the database | db/ |
| relative | is the file path specified relative? | true |
Important Notice
Please don't use one folder for all the paths, I have separated them for a reason.
4. Configure Redis
yaas use redis as a quick storage for managing background jobs. Currently, redis is not optional and is a requirement to run yaas.
redis: {
port: 6379,
host: '127.0.0.1'
}
// Redis server informaion
REDIS_PORT_6379_TCP_ADDR = 127.0.0.1
REDIS_PORT_6379_TCP_PORT = 6379
