Change hostname to host in oracle connection
This commit is contained in:
parent
430946345f
commit
57c02c0a8f
|
@ -27,20 +27,18 @@ A configuration then must define:
|
||||||
|
|
||||||
Where `some-model-module` is an existing `model` instance.
|
Where `some-model-module` is an existing `model` instance.
|
||||||
|
|
||||||
## AsteroidModule.optionsDefinition
|
## AsteroidModule.options
|
||||||
|
|
||||||
Asteroid Modules may also describe the options they accept. This will validate the configuration and make sure users have supplied required information and in a way that the module can use to construct a working instance.
|
Asteroid Modules may also describe the options they accept. This will validate the configuration and make sure users have supplied required information and in a way that the module can use to construct a working instance.
|
||||||
|
|
||||||
Here is an example options description for the [oracle database connection module](../connections/oracle-connection).
|
Here is an example options description for the [oracle database connection module](../connections/oracle-connection).
|
||||||
|
|
||||||
// must come after `inherits()`
|
OracleConnection.options = {
|
||||||
OracleConnection.defineOption('hostname', 'string', {required: true});
|
'hostname': {type: 'string', required: true},
|
||||||
OracleConnection.defineOption('port', 'number', {min: 10, max: 99999});
|
'port': {type: 'number', min: 10, max: 99999},
|
||||||
OracleConnection.defineOption('username', 'string');
|
'username': {type: 'string'},
|
||||||
OracleConnection.defineOption('password', 'string');
|
'password': {type: 'string'}
|
||||||
|
};
|
||||||
|
|
||||||
### AsteroidModule.defineOption(key, type, [options])
|
|
||||||
|
|
||||||
**key** the option name given in `config.json`.
|
**key** the option name given in `config.json`.
|
||||||
|
|
||||||
|
@ -51,10 +49,9 @@ Here is an example options description for the [oracle database connection modul
|
||||||
- number
|
- number
|
||||||
- array
|
- array
|
||||||
|
|
||||||
**options** depend on the type
|
**min/max** depend on the type
|
||||||
|
|
||||||
{
|
{
|
||||||
required: true, // options are optional by default
|
|
||||||
min: 10, // minimum length or value
|
min: 10, // minimum length or value
|
||||||
max: 100, // max length or value
|
max: 100, // max length or value
|
||||||
}
|
}
|
|
@ -35,17 +35,3 @@ function AsteroidModule(options) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inherits(AsteroidModule, Module);
|
inherits(AsteroidModule, Module);
|
||||||
|
|
||||||
/**
|
|
||||||
* Define an option of the given key/name with the provided type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
AsteroidModule.defineOption = function (key, type, options) {
|
|
||||||
var od = this.optionsDefinition = this.optionsDefinition || {};
|
|
||||||
|
|
||||||
options = options || {};
|
|
||||||
options.type = type;
|
|
||||||
|
|
||||||
od[key] = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,12 @@ function Connection(options) {
|
||||||
* Inherit from `AsteroidModule`.
|
* Inherit from `AsteroidModule`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inherits(Connection, AsteroidModule);
|
inherits(Connection, AsteroidModule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection Options
|
||||||
|
*/
|
||||||
|
|
||||||
|
Connection.options = {
|
||||||
|
"adapter": {type: "string"}
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ inherits(OracleConnection, Connection);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OracleConnection.options = {
|
OracleConnection.options = {
|
||||||
'hostname': {type: 'string', required: true},
|
'host': {type: 'string', required: true},
|
||||||
'port': {type: 'number', min: 10, max: 99999},
|
'port': {type: 'number', min: 10, max: 99999},
|
||||||
'username': {type: 'string'},
|
'username': {type: 'string'},
|
||||||
'password': {type: 'string'}
|
'password': {type: 'string'}
|
||||||
|
|
|
@ -36,5 +36,7 @@ function Store(options) {
|
||||||
var connection = (dependencies && dependencies.connection) || {};
|
var connection = (dependencies && dependencies.connection) || {};
|
||||||
var adapter = this.adapter = (connection && connection.adapter) || require('./memory');
|
var adapter = this.adapter = (connection && connection.adapter) || require('./memory');
|
||||||
|
|
||||||
|
// TODO determine how to
|
||||||
|
|
||||||
this.schema = new Schema(adapter, connection.options);
|
this.schema = new Schema(adapter, connection.options);
|
||||||
}
|
}
|
Loading…
Reference in New Issue