Added basic config file (#20)

* Added basic config file

* Replaced Object.assign with spread
This commit is contained in:
Harrison Healey 2016-10-17 11:38:59 -04:00 committed by GitHub
parent c8e4b6ee46
commit ebf6a95561
7 changed files with 42 additions and 23 deletions

2
.gitignore vendored
View file

@ -48,3 +48,5 @@ Session.vim
.netrwhist
*~
tags
config/config.secret.json

View file

@ -1,9 +1,4 @@
.PHONY: build run clean test
check-style: .npminstall
@echo Checking for style guide compliance
npm run check
.PHONY: run check-style test clean
.npminstall: package.json
@echo Getting dependencies using npm
@ -12,25 +7,25 @@ check-style: .npminstall
touch $@
build: .npminstall
@echo Building Mobile app
config/config.secret.json:
@echo Generating default config/config.secret.json
@echo '{}' > config/config.secret.json
rm -rf dist
npm run build
run: .npminstall
run: .npminstall config/config.secret.json
@echo Running Mobile iOS Apps for development
react-native run-ios
test: .npminstall config/config.secret.json
npm test
check-style: .npminstall
@echo Checking for style guide compliance
npm run check
clean:
@echo Cleaning app
rm -rf dist
rm -rf node_modules
rm -f .npminstall
test: .npminstall
npm test
rm -f .npminstall

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Mattermost Mobile
This project is the Mattermost mobile client from [https://mattermost.org](https://mattermost.org).
It's written in JavaScript using React Native.

3
config/config.json Normal file
View file

@ -0,0 +1,3 @@
{
"DefaultServerUrl": "http://localhost:8065"
}

View file

@ -4,6 +4,7 @@
import React, {Component} from 'react';
import Client from 'client/client_instance.js';
import Config from 'config/config.js';
import {connect} from 'react-redux';
import {getPing} from 'actions/general.js';
@ -41,7 +42,7 @@ class SelectServerView extends Component {
super(props);
this.state = {
serverUrl: 'http://localhost:8065'
serverUrl: Config.DefaultServerUrl
};
}

12
src/config/config.js Normal file
View file

@ -0,0 +1,12 @@
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import BaseConfig from '../../config/config.json';
import SecretConfig from '../../config/config.secret.json';
const Config = {
...BaseConfig,
...SecretConfig
};
export default Config;

View file

@ -4,6 +4,7 @@
import assert from 'assert';
import Client from 'client/client.js';
import Config from 'config/config.js';
const PASSWORD = 'password1';
@ -45,7 +46,7 @@ class TestHelper {
createClient = () => {
const client = new Client();
client.setUrl('http://localhost:8065');
client.setUrl(Config.DefaultServerUrl);
return client;
}
@ -94,7 +95,7 @@ class TestHelper {
}
initClient = (client, callback) => {
client.setUrl('http://localhost:8065');
client.setUrl(Config.DefaultServerUrl);
client.createUser(
this.fakeUser(),
@ -173,4 +174,4 @@ class TestHelper {
}
}
export default new TestHelper();
export default new TestHelper();