Change hostname to host in oracle connection

This commit is contained in:
Ritchie Martori 2013-04-15 14:13:49 -07:00
parent 430946345f
commit 57c02c0a8f
5 changed files with 20 additions and 27 deletions

View File

@ -27,20 +27,18 @@ A configuration then must define:
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.
Here is an example options description for the [oracle database connection module](../connections/oracle-connection).
// must come after `inherits()`
OracleConnection.defineOption('hostname', 'string', {required: true});
OracleConnection.defineOption('port', 'number', {min: 10, max: 99999});
OracleConnection.defineOption('username', 'string');
OracleConnection.defineOption('password', 'string');
### AsteroidModule.defineOption(key, type, [options])
OracleConnection.options = {
'hostname': {type: 'string', required: true},
'port': {type: 'number', min: 10, max: 99999},
'username': {type: 'string'},
'password': {type: 'string'}
};
**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
- 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
max: 100, // max length or value
}

View File

@ -35,17 +35,3 @@ function AsteroidModule(options) {
*/
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;
}

View File

@ -39,4 +39,12 @@ function Connection(options) {
* Inherit from `AsteroidModule`.
*/
inherits(Connection, AsteroidModule);
inherits(Connection, AsteroidModule);
/**
* Connection Options
*/
Connection.options = {
"adapter": {type: "string"}
}

View File

@ -42,7 +42,7 @@ inherits(OracleConnection, Connection);
*/
OracleConnection.options = {
'hostname': {type: 'string', required: true},
'host': {type: 'string', required: true},
'port': {type: 'number', min: 10, max: 99999},
'username': {type: 'string'},
'password': {type: 'string'}

2
node_modules/store/lib/store.js generated vendored
View File

@ -36,5 +36,7 @@ function Store(options) {
var connection = (dependencies && dependencies.connection) || {};
var adapter = this.adapter = (connection && connection.adapter) || require('./memory');
// TODO determine how to
this.schema = new Schema(adapter, connection.options);
}