I am trying to understand how the functional integral for Chern-Simons theory for a possibly non-compact 3-manifold with boundary is made gauge invariant.

For a compact 3-manifold, $M$, without boundary, it is well known (see, for example, section 2 of this reference), that for a compact simple Lie group $G$ and trivial principal G-bundle $P\rightarrow M$, one may define the Chern-Simons action \begin{equation} S[A]=\frac{k}{4\pi}\int_M\textrm{Tr}\bigg(A\wedge dA+\frac{2}{3}A\wedge A\wedge A\bigg). \end{equation} Here, the group, $\mathcal{G}$, of gauge transformations of $P$, is isomorphic to the group of smooth maps from $M$ to $G$. Under a gauge transformation $g\in \mathcal{G}$, the action changes by the sum of a boundary term and $\textrm{deg}(g)$, which labels the corresponding component of $\mathcal{G}$. The group, $\pi_0(\mathcal{G})$, of components is isomorphic to the group of homotopy classes of maps from $M$ to $G$, which for simply connected $G$ is isomorphic to $\pi_3(G)$. Since $G$ is simple, $\pi_3(G)\cong\mathbb{Z}$. Thus, upon requiring that $k$ is quantized, we find that the integrand of the functional integral, $e^{iS}$, is invariant under gauge transformations.

My question is, how does one extend this to the case where $M$ has a boundary, and is possibly noncompact? The example I have in mind is $M=D\times \mathbb{R}$, where $D$ is the disk. In this paper, it is explained that for gauge invariance, one first chooses one of the boundary components of the connection, $A$, to be zero, and with such a boundary condition the functional integral is invariant **only under gauge transformations
which are one at the boundary**. This requirement is also alluded to below equation 3.18 of this paper by Dijkgraaf and Witten.

It is clear to me that the aforementioned boundary term that arises via gauge transformation will vanish via the boundary condition.

However, it is not clear to me why we require that $g$ be 1 at the boundary for gauge invariance.

Firstly, why do we need to impose another boundary condition on $g$, i.e., in addition to the constraint required to preserve the boundary condition on $A$ under gauge transformations? Secondly, why would another constant value for $g$ at the boundary not suffice? I would think that any common value for $g$ along the boundary would imply that we are effectively studying $M$ with boundary points identified, which is a closed 3-manifold, for which we can apply the arguments of the second paragraph above.