Skip to content
Snippets Groups Projects
Commit 3844bc6a authored by Adam Procter's avatar Adam Procter
Browse files

added enviromental variables

Added the development and production variables for use in the project to help manage the location of CouchDB.
parent 3abcfff9
Branches env
No related tags found
No related merge requests found
# 0.1.1
_29th Feb 2020_
After Toby tried to start working on the main code base it soon become evident that the CouchDB set up was problematic. So I have moved this to environmental variables and now you can set up and use local and remote CouchDBs. The CouchDB needs to be on and have a server admin account so you can enter these into the environment variables. This reduces the process for onboard developers a lot!
### Changed
- Now using CouchDB 3
- Now using Environmental Variables (.env) to store the URL and log in for CouchDB meaning you can now change this information to suit your setup.
- Changed DeBug.vue to reload to your current install local or otherwise.
# Guide
## Use the following headers for each log
Delete as you see fit and use # for version number
......
......@@ -2,11 +2,35 @@
Don’t show off. Its ok if your code is verbose the easier to read, the _better_.
All our code will use the GNU Affero General Public [License](LICENSE.md).Any dependancies that are brought into nodenogg.in must have as open a License as possible. Dependancies should be loaded in via Vue.js ui cli.
## Getting Started
To get started you need to be running Vue.js and CouchDB. You can install a local CouchDB from https://couchdb.apache.org/ on to your computer. You will need to create a server admin account on your CouchDB for nodenogg.in to use.
Then in the code create a .env.local file at the root (under app) for use in your development the file format is as follows, using in your CouchDB details (obviously).
```
VUE_APP_COUCH_HTTP=http
VUE_APP_COUCH_URL=@127.0.0.1:5984/
VUE_APP_COUCH_USER=username
VUE_APP_COUCH_PASS=yourpassword
```
If you are deploying then create another file called .env.production.local again editing to fit your production CouchDB location.
```
VUE_APP_COUCH_HTTP=https
VUE_APP_COUCH_URL=@myremote.couchdb.com/
VUE_APP_COUCH_USER=username
VUE_APP_COUCH_PASS=yourpassword
```
## Basics
Please Use arrow functions as much ES6 as possible. We want the code to be as neat as possible. However all code should be human understandable. So again verbose is good.
Please note we use [PouchDB](https://pouchdb.com/) to talk to CouchDB. This is what enables offline and local first support.
All the internal code should use the GNU Affero General Public [License](LICENSE.md).Any dependancies that are brought into nodenogg.in must have as open a License as possible. Dependancies should be loaded in via Vue.js ui cli.
Please Use arrow functions,and as much ES6 as possible. The code should be as neat as possible. However all code should be human understandable. So again verbose is good.
All if statements should use curly braces to indicate the statement block { } please
......@@ -35,15 +59,15 @@ The code base is mirrored to github for two reasons. Backup and to support organ
## Semantic versioning
This repo started the 0.1.0 From now on all branches will be considered patches so the naming convention will be incrementing the final digit MAJOR.MINOR.PATCH so the next version is 0.1.1 more on Semantic versioning can be read [here](https://semver.org/)
This repo started at 0.1.0 all branches will be considered patches so the naming convention will be incrementing the final digit MAJOR.MINOR.PATCH so the very next version would be 0.1.1 more on Semantic versioning can be read [here](https://semver.org/)
Versions increase when app code base changes. Documentation changes do not bump versions.
Versions increase when app code base changes. Documentation changes do not require version changes please.
## Feature Branches
We use the feature branch workflow. Please do not work from master, check out master and branch. Once work is completed do a pull request to master. A longer guide is [here](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow)
We use the feature branch workflow. Please do not work from master, check out master and branch. Once work is completed do a pull request to the master. A longer guide is [here](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow)
There are special branches which will deploy to online versions of nodenogg.in, beta, alpha and release. Do not work from or pull request to these branches. These are used for deployment only.
There are some special branches which will deploy to online versions of nodenogg.in, beta, alpha and release. Do not work from or pull request to these branches. These are used for internal deployment only.
## Changelog
......@@ -51,4 +75,4 @@ Please update the [Changelog](CHANGELOG.md) as part of a pull request to the mas
## Languages Used
As much Vanilla javascript as possible and Vue.js
As much Vanilla javascript as possible and Vue.js.
......@@ -4,7 +4,6 @@ node_modules
/src/assets/settings.json
# local env files
.env
.env.local
.env.*.local
......
{
"name": "nodenogg.in",
"version": "0.0.1",
"version": "0.1.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......
......@@ -2,21 +2,20 @@
<div class="debug">
<hr />
<!-- <h2>Debug Options</h2> -->
<h4>LAST UPDATE 24th Feb 2020.</h4>
<h4>LAST UPDATE 29th Feb 2020.</h4>
<p>You need to know what these buttons do before you press them.</p>
<button class="danger" @click="removeLocal()">
Join another microcosm
</button>
<button class="danger" @click="removeLocal()">Join another microcosm</button>
<!-- <button @click="exportStorage()">Export my contributions</button>
<button class="danger" v-on:click="deleteClient">
Delete my contributions (inc. attachments) permanently
</button>
<button @click="handleConnection()">Online check</button> -->
<button @click="handleConnection()">Online check</button>-->
<p>That's why they are red.</p>
</div>
</template>
<script>
// This is for detecting offline issues
var serverUrl = 'https://nodenogg.in'
export default {
......@@ -32,9 +31,10 @@ export default {
removeLocal: function() {
localStorage.removeItem('myNNClient')
localStorage.removeItem('mylastMicrocosm')
// Hardcoded in thye case that a URL had parameters the reload fails
location.assign('https://alpha.nodenogg.in/')
// Hardcoded as when I set a URL had parameters the reload fails
//location.assign('https://alpha.nodenogg.in/')
//location.assign('http://localhost:8080/')
location.reload()
},
deleteClient() {
......
......@@ -4,8 +4,6 @@ import PouchDB from 'pouchdb'
PouchDB.plugin(require('pouchdb-find'))
import VueDraggableResizable from 'vue-draggable-resizable'
import accounts from '../assets/settings.json'
Vue.use(Vuex)
Vue.component('vue-draggable-resizable', VueDraggableResizable)
var myclient = 'firstvisit'
......@@ -24,16 +22,15 @@ if (localStorage.getItem('myNNClient') == null) {
var pouchdb = new PouchDB(microcosm)
var remote =
'https://' +
accounts.settings[0].name +
process.env.VUE_APP_COUCH_HTTP +
'://' +
process.env.VUE_APP_COUCH_USER +
':' +
accounts.settings[0].password +
accounts.settings[0].url +
process.env.VUE_APP_COUCH_PASS +
process.env.VUE_APP_COUCH_URL +
microcosm +
'/'
//var remote = 'http://127.0.0.1:5984/localcouch'
const store = new Vuex.Store({
state: {
localnodeid: '',
......@@ -78,19 +75,17 @@ const store = new Vuex.Store({
mutations: {
CREATE_MICROCOSM(state, doc) {
pouchdb.close().then(function() {
// console.log(doc)
microcosm = doc
pouchdb = new PouchDB(microcosm)
remote =
'https://' +
accounts.settings[0].name +
process.env.VUE_APP_COUCH_HTTP +
'://' +
process.env.VUE_APP_COUCH_USER +
':' +
accounts.settings[0].password +
accounts.settings[0].url +
process.env.VUE_APP_COUCH_PASS +
process.env.VUE_APP_COUCH_URL +
microcosm +
'/'
// remote = 'http://127.0.0.1:5984/localcouch'
store.dispatch('syncDB')
})
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment