Ind.ie is now Small Technology Foundation.
Commit b319831e authored by Frauke's avatar Frauke

Merge branch 'master' into production

parents 8b0fcbd4 dbbbf7af
......@@ -109,7 +109,8 @@ $RECYCLE.BIN/
# Others
.nuxt/
server/db/data
client/static/uploads/*
!client/static/uploads/.gitkeep
server/secret.json
.hallo-gent/data
.hallo-gent/secret.json
!hallo-gent/.gitkeep
......@@ -30,9 +30,10 @@ Getting up and running is as easy as 1, 2, 3.
## Magic Web Factory
This is an API were a domain and server can be requested.
Currently this is mocked, you can find the source code for this [here](https://source.ind.ie/indienet/spikes/magic-website-factory).
In a later stage, this will be changed to a real API.
At a later stage, this will be changed to an actual implementation.
## Testing
......@@ -42,6 +43,28 @@ Simply run `npm test` and all your tests in the `test/` directory will be run.
For more in detail information about this project please visit: [indienet.info/hallo.gent](https://indienet.info/hallo.gent/).
## Deployment
We are currently testing deployments with the following git remote:
```bash
git remote add deploy dokku@hallo.gent:hallo.gent
```
You will need SSH access to the server to test the deployment.
To deploy:
```bash
git push deploy master
```
To tail the logs on the server, SSH to hallo.gent and then:
```bash
dokku logs hallo.gent -t
```
## Services
### Important notes
......
......@@ -10,7 +10,7 @@
@invalid="validate"
@keyup="checkValidity"
@input="input">
<button type="submit" class="btn" :disabled="submitDisabled">{{ button }}</button>
<button type="submit" class="btn">{{ button }}</button>
</form>
</div>
</template>
......
......@@ -18,7 +18,7 @@
v-bind:class="['domainChecker__availability', isAvailable ? 'available' : '' ]">{{ available
}}</span>
</div>
<button type="submit" class="btn" :disabled="!isAvailable">{{ button }}</button>
<button type="submit" class="btn">{{ button }}</button>
</form>
</div>
</template>
......@@ -102,7 +102,7 @@
})
.catch(err => {
this.availability = 'unknown'
e.target.setCustomValidity('')
e.target.setCustomValidity(this.available)
})
}, 500)
},
......
const fileUtils = require('./server/helpers/fileUtils')
const crypto = require('crypto')
fileUtils.fileExists('./server/secret.json')
fileUtils.fileExists('./.hallo-gent/secret.json')
.then(data => {
if (!data) {
const secret = crypto.randomBytes(256).toString('hex')
fileUtils.writeFile('secret.json', `{"secret" : "${secret}"}`, './server')
fileUtils.writeFile('secret.json', `{"secret" : "${secret}"}`, './.hallo-gent')
.catch(err => console.log(err))
}
})
......@@ -166,7 +166,7 @@
},
"@sinonjs/formatio": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz",
"resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz",
"integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==",
"dev": true,
"requires": {
......@@ -16190,7 +16190,7 @@
},
"onetime": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
"resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz",
"integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=",
"dev": true
},
......
......@@ -26,7 +26,7 @@ const services = require('./services')
const appHooks = require('./app.hooks')
const channels = require('./channels')
const secretFile = require('./secret.json')
const secretFile = require('../.hallo-gent/secret.json')
const app = express(feathers())
......
......@@ -2,7 +2,7 @@ const level = require('level')
const path = require('path')
const subLevel = require('level-sublevel')
const dbPath = process.env.DB_PATH || path.join(__dirname, 'data')
const dbPath = process.env.DB_PATH || path.join(__dirname, '../../.hallo-gent/data')
const levelDB = level(dbPath, {
valueEncoding: 'json'
}, function (err, db) {
......
const fs = require('fs')
const fs = require('fs-extra')
const path = require('path')
// Writes a string to the filesystem.
......@@ -57,6 +57,12 @@ function removeFile (fileName) {
})
}
// remove a dir
function removeDir(path) {
console.log(path)
return fs.remove(path)
}
// check if a file exists
function fileExists (fileName) {
return new Promise((resolve, reject) => {
......@@ -72,5 +78,6 @@ module.exports = {
readFile,
makeDir,
fileExists,
removeFile
removeFile,
removeDir
}
const jwt = require('jsonwebtoken')
const AccountCode = require('../../db/models/accountCode')
const PendingSite = require('../../db/models/pendingSite')
const secretFile = require('../../secret.json')
const secretFile = require('../../../.hallo-gent/secret.json')
class Service {
constructor (options) {
......
const PendingSite = require('../../db/models/pendingSite')
const messagesDb = require('../../db/services/messagesDb')
const fileUtils = require('../../helpers/fileUtils')
class Service {
constructor (options) {
......@@ -23,6 +24,9 @@ class Service {
// Delete all information about the site
await site.remove()
// Delete images from site
await fileUtils.removeDir(`./client/static/uploads/${id}`)
// delete the conversation on the server.
await messagesDb.deleteConversation(metaData.accountCode)
......
......@@ -12,7 +12,7 @@ const {pendingSitesSublevel} = require('../../db/levelDb')
const db = new Database(accountCodesSublevel)
const dbSite = new Database(pendingSitesSublevel)
const secretFile = require('../../secret.json')
const secretFile = require('../../../.hallo-gent/secret.json')
describe('\'Authenticate\' service', () => {
const code = 'testCode'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment