Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Feature/ Handle refreshing in case auth secret is missing #53

Open
2 tasks
faraonc opened this issue May 17, 2019 · 0 comments
Open
2 tasks

Feature/ Handle refreshing in case auth secret is missing #53

faraonc opened this issue May 17, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@faraonc
Copy link
Member

faraonc commented May 17, 2019

Description

As a developer, I want app-gateway-svc to handle refreshing invalid or missing auth secret

func init() {
	userSvc = &userService{}
	if err := refreshConnection(userSvc, consts.UserClientTag); err != nil {
		// TODO once docker container is runnable
		log.Error(consts.UserClientTag, err.Error())
		//log.Fatal(consts.UserClientTag, err.Error())
	}
	// NOTE:
	// app-gateway-svc does not start if all the services are not ready
	// this is ONLY on app-gateway-svc startup
	resp, err := userSvc.getStatus()
	if err != nil {
		// TODO once docker container is runnable
		log.Error(consts.UserClientTag, err.Error())
		//log.Fatal(consts.UserClientTag, err.Error())
	} else {
		log.Info(consts.UserClientTag, resp.String())
	}

	// TODO handle refreshing in case auth secret is missing
	if err := userSvc.refreshCurrAuthSecret(); err != nil {
		// NOTE: Check PSQL migration or if there is an active secret
		log.Error(consts.UserClientTag, err.Error())
	} else {
		log.Info(consts.UserClientTag, "AuthSecret obtained")
	}

	// Handle Terminate Signal(Ctrl + C)
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt, syscall.SIGTERM)
	go func() {
		<-c
		if err := disconnect(userSvc.userSvcConn, consts.UserClientTag); err != nil {
			log.Error(consts.UserClientTag, err.Error())
		}
		log.Info(consts.UserClientTag, "hwsc-app-gateway-svc terminated")
		serviceWg.Done()
	}()

}

Story Points

5

Definitions of Done

  • implementation
  • unit test
@faraonc faraonc added the enhancement New feature or request label May 17, 2019
@faraonc faraonc self-assigned this May 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant