Commit e25a42da authored by Muhammad Umair Zafar's avatar Muhammad Umair Zafar
Browse files

add URLs into .meepctl-repocfg file and resolve the deployment issue of meep-sandbox-api

parent 2bd570b8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -31,16 +31,19 @@ image:
  pullPolicy: Always
  env:
    MEEP_SVC_PATH: /sandbox-api/v1
    MEEP_OAUTH_GITHUB_ENABLED: ""
    MEEP_OAUTH_GITHUB_AUTH_URL: ""
    MEEP_OAUTH_GITHUB_POLL_URL: ""
  envSecret:
    MEEP_SESSION_KEY:
      name: meep-session
      key: encryption-key
    MEEP_OAUTH_GITHUB_CLIENT_ID:
      name: meep-oauth-github
      name: github-secret
      key: client-id
    # MEEP_OAUTH_GITHUB_SECRET:
    #   name: meep-oauth-github
    #   key: secret
    MEEP_OAUTH_GITHUB_SECRET:
      name: meep-secret
      key: secret

service:
  type: ClusterIP
+6 −4
Original line number Diff line number Diff line
@@ -64,9 +64,6 @@ const redisTable = 0
const moduleName = "meep-sandbox-api"
const moduleNamespace = "default"
var baseKey string
var request_url string = "https://github.com/login/device/code"
var pollingRequestUrl string = "https://github.com/login/oauth/access_token"
 
const authBasepath = "http://meep-auth-svc//auth/v1"
const sbxCtrlUrl = "http://192.168.10.42" //"http://meep-sandbox-ctrl"
const pfmCtrlBasepath = "http://meep-platform-ctrl/platform-ctrl/v1"
@@ -327,12 +324,17 @@ func login(w http.ResponseWriter, r *http.Request) {
	metric.User = userId

	clientID := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_CLIENT_ID"))
	requestUrl := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_AUTH_URL"))
	pollingRequestUrl := strings.TrimSpace(os.Getenv("MEEP_OAUTH_GITHUB_POLL_URL"))
	log.Info("Client ID is ", clientID)
	log.Info("REQUEST URL is ", requestUrl)
	log.Info("POLLING REQUEST URL is ", pollingRequestUrl)

	// Prepare the request body
	body := strings.NewReader(fmt.Sprintf(`{"client_id": "%s"}`, clientID))

	// Create a new HTTP request
	req, err := http.NewRequest("POST", request_url, body)
	req, err := http.NewRequest("POST", requestUrl, body)
	if err != nil {
		log.Info("Error creating request:", err)
		return
+5 −1
Original line number Diff line number Diff line
@@ -495,20 +495,24 @@ func deployRunScriptsAndGetFlags(targetName string, chart string, cobraCmd *cobr
			flags = utils.HelmFlags(flags, "--set", "image.env.MEEP_GC_POSTGIS_ENABLED="+strconv.FormatBool(gcPostgisEnabled))
		}
	case "meep-sandbox-api":
		authEnabled := utils.RepoCfg.GetBool("repo.deployment.auth.enabled")
		sessionKeySecret := utils.RepoCfg.GetString("repo.deployment.auth.session.key-secret")
		if sessionKeySecret != "" {
			flags = utils.HelmFlags(flags, "--set", "image.envSecret.MEEP_SESSION_KEY.name="+sessionKeySecret)
		}
		githubEnabled := utils.RepoCfg.GetBool("repo.deployment.auth.github.enabled")
		if githubEnabled {
			authUrl := utils.RepoCfg.GetString("repo.deployment.auth.github.auth-url")
			secret := utils.RepoCfg.GetString("repo.deployment.auth.github.secret")
			pollUrl := utils.RepoCfg.GetString("repo.deployment.auth.github.poll-url")
			flags = utils.HelmFlags(flags, "--set", "image.env.MEEP_OAUTH_GITHUB_ENABLED=true")
			flags = utils.HelmFlags(flags, "--set", "image.env.MEEP_OAUTH_GITHUB_AUTH_URL="+authUrl)
			flags = utils.HelmFlags(flags, "--set", "image.env.MEEP_OAUTH_GITHUB_POLL_URL="+pollUrl)
			if secret != "" {
				flags = utils.HelmFlags(flags, "--set", "image.envSecret.MEEP_OAUTH_GITHUB_CLIENT_ID.name="+secret)
				flags = utils.HelmFlags(flags, "--set", "image.envSecret.MEEP_OAUTH_GITHUB_SECRET.name="+secret)
			}
		}
		authEnabled := utils.RepoCfg.GetBool("repo.deployment.auth.enabled")
		if authEnabled {
			flags = utils.HelmFlags(flags, "--set", authUrlAnnotation+"="+authUrl+"?svc=meep-sandbox-api")
		}