SugoiJS
Demo
Git
NPM
Slack
Search…
V4.0
What is SugoiJS?
Get started
Core concept - FP & OOP
@sugoi/cli
Getting started
Configurations
sugoi.json
Commands
Get build configuration
@sugoi/server
Getting started
Modules
Bootstrapping
Define a route (Controller)
Setting services (Injectables)
CRUD Controller
Response handling
Parameters validation
Authorization
Delay module initialization
Hooks
Timeout
Using configuration
@Sugoi/ORM
Getting started
RESTFUL model
Connectable model
Model interface
Lifecycle
Setting CRUD logic
QueryOptions (sort, page, limit)
Model name
Primary key
Data handling
@sugoi/socket
Getting started
Bootstrapping
Binding a function to event
Middlewares
Handling server & namespace
Dynamic event handling
Schema validator
@sugoi/redis
Getting started
Boostrapping
RedisProvider
Pub/Sub
Scripts
@sugoi/core
Getting started
Policies (Filters)
Singleton
Exception
Casting
@Catch - error handling
@PostConstruct()
@Iterable()
@Deprecated
@OnEvent - event handling
Run time decorate ( + JS support)
ComparableSchema
Using configuration
Extra
Full demo
ORM demo
Upgrade to V4
Powered By
GitBook
Configurations
Environment based configuration
Overview
Since V4 of SugoiJS, it's allowed to define properties as part of the configuration of application.
The configuration directory found on the root level of the server directory, in the following structure:
root
server
configuration
default
security.js
ssl.js
variables.js
<environment>
security.js
ssl.js
variables.js
Take a look on the build part of the
@sugoi/cli
​
​
Configuration files
security.js
Powered by
HelmetJS
. Provides basic security layer to you web server.
Configuration
{
enabled
:
true
,
options
:
undefined
// use helmetjs default configuration, can be replace by:
​
// more info: https://helmetjs.github.io/docs
// {
// contentSecurityPolicy: {
// directives: {
// defaultSrc: ["'self'"],
// styleSrc: ["'self'", 'maxcdn.bootstrapcdn.com']
// }
// },
// dnsPrefetchControl: true,
// frameguard: true,
// hidePoweredBy: true,
// hpkp: {
// maxAge: 7776000,
// sha256s: ['AbCdEf123=', 'ZyXwVu456=']
// },
// hsts: true,
// ieNoOpen: true,
// noCache: false,
// noSniff: true,
// xssFilter: true,
// expectCt: true
// }
}
ssl.js
Define the path to the ssl certificate files
Configuration
const
path
=
require
(
'path'
);
​
module
.
exports
=
null
// can be replaced with:
{
cert
:
path
.
resolve
(
'pathToCertFile'
),
key
:
path
.
resolve
(
'pathToKeyFile'
)
}
variables.js
Map of environment variables to inject in build time.
access to those environment variable is possible via environment variables
​
Many others...
Feel free to add your files which their content will be added to the configuration map that available in run-time.
Access to configuration variables is possible using c
onfiguration resolv
ing.
@sugoi/cli - Previous
Getting started
Next - @sugoi/cli
sugoi.json
Last modified
3yr ago
Copy link
Outline
Overview
Configuration files
security.js
variables.js
Many others...