Skip to content

Commit

Permalink
Merge pull request #55 from randombenj/feature/config-file
Browse files Browse the repository at this point in the history
Feature/config file
  • Loading branch information
randombenj authored Apr 7, 2020
2 parents 41b98bc + 0d4d1d7 commit e587e29
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ yarn lint
### Basic Header Theeming

Not happy with the default Docat logo and header?
Just add your custom html header with `VUE_APP_HEADER_HTML`.
Just add your custom html header to the `/var/www/html/config.json` file.

```
VUE_APP_HEADER_HTML="<h1>MyCompany</h1>"
{"headerHTML": "<h1>MyCompany</h1>"}
```

### Customize configuration
Expand Down
4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"rules": {
"no-console": "off"
},
"parserOptions": {
"parser": "babel-eslint"
},
Expand Down
12 changes: 10 additions & 2 deletions web/src/components/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@
</template>

<script>
import ProjectRepository from '@/repositories/ProjectRepository'
export default {
name: 'layout',
props: {
fullscreen: Boolean,
},
data() {
const defaultHeader = '<img class="logo" alt="docat logo" src="' + require('../assets/logo.png') + '" /><h1>DOCAT</h1>';
const defaultHeader = '<img class="logo" alt="docat logo" src="' + require('../assets/logo.png') + '" /><h1>DOCAT</h1>'
return {
header: process.env.VUE_APP_HEADER_HTML || defaultHeader,
header: defaultHeader,
}
},
async created() {
const config = ProjectRepository.getConfig()
if (config.hasOwnProperty('headerHTML')){
this.header = config.headerHTML
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions web/src/repositories/ProjectRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ import Repository from '@/repositories/Repository'
const resource = 'doc'
export default {

/**
* Get Config
*/
async getConfig() {
try {
const result = await Repository.get(`${Repository.defaults.baseURL}/config.json`)
return result.data;
} catch {
return {}
}
},

/**
* Returns all projects
*/
Expand Down

0 comments on commit e587e29

Please sign in to comment.