Skip to content

Commit

Permalink
Add support for generic elasticsearch clusters #201
Browse files Browse the repository at this point in the history
  • Loading branch information
metagrover committed Aug 30, 2017
1 parent 2e7f8a1 commit 3ffe2b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions app/middleware/ReactiveBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@ const helper = require("./helper.js");
export default class ReactiveBase extends Component {
constructor(props, context) {
super(props);

this.state = {};
this.type = this.props.type ? this.props.type : "*";

const credentials = this.props.url && this.props.url.trim() !== "" && !this.props.credentials
? "test:test"
: this.props.credentials;

this.appbaseRef = new Appbase({
url: "https://scalr.api.appbase.io",
url: this.props.url && this.props.url.trim() !== "" ? this.props.url : "https://scalr.api.appbase.io",
appname: this.props.app,
credentials: this.props.credentials,
credentials: credentials,
type: this.type
});

this.appbaseCrdentials = {
url: "https://scalr.api.appbase.io",
credentials: this.props.credentials,
url: this.props.url && this.props.url.trim() !== "" ? this.props.url : "https://scalr.api.appbase.io",
credentials: credentials,
appname: this.props.app,
type: this.type
};

this.reactiveId = helper.RecactivebaseComponents.length;
helper.RecactivebaseComponents[this.reactiveId] = [];
}
Expand Down Expand Up @@ -73,6 +81,7 @@ export default class ReactiveBase extends Component {
}

ReactiveBase.propTypes = {
url: React.PropTypes.string,
app: React.PropTypes.string.isRequired,
credentials: helper.reactiveBaseValidation,
type: React.PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const pagesValidation = function(props, propName) {

export const reactiveBaseValidation = (props, propName) => {
let err = null;
if (!props.credentials) {
if (!props.credentials && !props.url) {
err = new Error("ReactiveBase expects credentials as a prop instead of username:password.");
}
return err;
Expand Down

0 comments on commit 3ffe2b0

Please sign in to comment.