This commit is contained in:
Jason Kulatunga 2022-08-22 18:11:00 -07:00
parent cc9948cd04
commit d46f12928e
18 changed files with 61 additions and 43 deletions

View File

@ -3,5 +3,5 @@
npm run dist
go mod vendor
go run backend/cmd/webcli/webcli.go start --config ./config.yaml
go run backend/cmd/fasten/fasten.go start --config ./config.yaml
```

View File

@ -3,7 +3,7 @@
Find & replace the following
- `packagrio/goweb-template` - replace this with your github project name (owner/reponame)
- `webcli` - find and replace this with your binary name
- `fastenhealth/fastenhealth-onprem` - replace this with your github project name (owner/reponame)
- `fastenhealth` - find and replace this with your binary name
- make sure you rename the folder as well.

View File

@ -4,10 +4,28 @@ import (
"encoding/json"
"fmt"
"github.com/analogj/go-util/utils"
"github.com/packagrio/goweb-template/backend/pkg/config"
"github.com/packagrio/goweb-template/backend/pkg/errors"
"github.com/packagrio/goweb-template/backend/pkg/version"
"github.com/packagrio/goweb-template/backend/pkg/web"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/errors"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/version"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/web"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"io"
"log"
"os"
"time"
)
\
import (
"encoding/json"
"fmt"
"github.com/analogj/go-util/utils"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/errors"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/version"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/web"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"io"
@ -48,7 +66,7 @@ func main() {
},
Before: func(c *cli.Context) error {
packagrUrl := "github.com/packagrio/goweb-template"
packagrUrl := "github.com/fastenhealth/fastenhealth-onprem"
versionInfo := fmt.Sprintf("%s.%s-%s", goos, goarch, version.VERSION)
@ -69,7 +87,7 @@ func main() {
Commands: []*cli.Command{
{
Name: "start",
Usage: "Start the webcli server",
Usage: "Start the fasten server",
Action: func(c *cli.Context) error {
//fmt.Fprintln(c.App.Writer, c.Command.Usage)
if c.IsSet("config") {

View File

@ -3,7 +3,7 @@ package config
import (
"fmt"
"github.com/analogj/go-util/utils"
"github.com/packagrio/goweb-template/backend/pkg/errors"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/errors"
"github.com/spf13/viper"
"log"
"os"
@ -24,7 +24,7 @@ func (c *configuration) Init() error {
c.SetDefault("web.listen.port", "8080")
c.SetDefault("web.listen.host", "0.0.0.0")
c.SetDefault("web.listen.basepath", "")
c.SetDefault("web.src.frontend.path", "/opt/webcli/web")
c.SetDefault("web.src.frontend.path", "/opt/fasten/web")
c.SetDefault("log.level", "INFO")
c.SetDefault("log.file", "")
@ -37,7 +37,7 @@ func (c *configuration) Init() error {
c.AddConfigPath("$HOME/")
//configure env variable parsing.
c.SetEnvPrefix("PACKAGR")
c.SetEnvPrefix("FASTEN")
c.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
c.AutomaticEnv()
//CLI options will be added via the `Set()` function

View File

@ -1,9 +1,9 @@
package handler
import (
//"github.com/packagrio/goweb-template/backend/pkg/database"
//"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
"github.com/gin-gonic/gin"
//"github.com/packagrio/goweb-template/backend/pkg/config"
//"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
//"github.com/sirupsen/logrus"
"net/http"
)

View File

@ -1,8 +1,8 @@
package middleware
import (
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/gin-gonic/gin"
"github.com/packagrio/goweb-template/backend/pkg/config"
)
func ConfigMiddleware(appConfig config.Interface) gin.HandlerFunc {

View File

@ -2,10 +2,10 @@ package web
import (
"fmt"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/config"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/web/handler"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/web/middleware"
"github.com/gin-gonic/gin"
"github.com/packagrio/goweb-template/backend/pkg/config"
"github.com/packagrio/goweb-template/backend/pkg/web/handler"
"github.com/packagrio/goweb-template/backend/pkg/web/middleware"
"github.com/sirupsen/logrus"
"net/http"
"strings"

View File

@ -2,7 +2,7 @@
# Version
#
# version specifies the version of this configuration file schema, not
# the webcli binary. There is only 1 version available at the moment
# the fasten binary. There is only 1 version available at the moment
version: 1
web:
@ -10,15 +10,15 @@ web:
port: 8080
host: 0.0.0.0
# if you're using a reverse proxy like apache/nginx, you can override this value to serve webcli on a subpath.
# eg. http://example.com/webcli/* vs http://example.com:8080
# basepath: `/webcli`
# if you're using a reverse proxy like apache/nginx, you can override this value to serve fasten on a subpath.
# eg. http://example.com/fasten/* vs http://example.com:8080
# basepath: `/fasten`
# leave empty unless behind a path prefixed proxy
basepath: ''
src:
# the location on the filesystem where webapp javascript + css is located
frontend:
path: /opt/webcli/web
path: /opt/fasten/web
# path: ./dist
log:

View File

@ -1,4 +1,4 @@
# Webcli
# fastenhealth
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.4.

View File

@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"webcli": {
"fastenhealth": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
@ -17,7 +17,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/webcli",
"outputPath": "dist/fastenhealth",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
@ -66,18 +66,18 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "webcli:build"
"browserTarget": "fastenhealth:build"
},
"configurations": {
"production": {
"browserTarget": "webcli:build:production"
"browserTarget": "fastenhealth:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "webcli:build"
"browserTarget": "fastenhealth:build"
}
},
"test": {
@ -114,15 +114,15 @@
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "webcli:serve"
"devServerTarget": "fastenhealth:serve"
},
"configurations": {
"production": {
"devServerTarget": "webcli:serve:production"
"devServerTarget": "fastenhealth:serve:production"
}
}
}
}
}},
"defaultProject": "webcli"
"defaultProject": "fastenhealth"
}

View File

@ -10,7 +10,7 @@ describe('workspace-project App', () => {
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('webcli app is running!');
expect(page.getTitleText()).toEqual('fastenhealth app is running!');
});
afterEach(async () => {

View File

@ -16,7 +16,7 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/webcli'),
dir: require('path').join(__dirname, './coverage/fasten'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},

View File

@ -1,11 +1,11 @@
{
"name": "webcli",
"name": "fastenhealth",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "webcli",
"name": "fastenhealth",
"version": "0.0.0",
"dependencies": {
"@angular/animations": "~9.1.4",

View File

@ -1,5 +1,5 @@
{
"name": "webcli",
"name": "fasten",
"version": "0.0.0",
"scripts": {
"ng": "ng",

View File

@ -20,16 +20,16 @@ describe('AppComponent', () => {
expect(app).toBeTruthy();
});
it(`should have as title 'webcli'`, () => {
it(`should have as title 'fastenhealth'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('webcli');
expect(app.title).toEqual('fastenhealth');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('webcli app is running!');
expect(compiled.querySelector('.content span').textContent).toContain('fastenhealth app is running!');
});
});

View File

@ -6,5 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'webcli';
title = 'fastenhealth';
}

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Webcli</title>
<title>fastenhealth</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/packagrio/goweb-template
module github.com/fastenhealth/fastenhealth-onprem
go 1.18