Skip to content

Commit baa7066

Browse files
committed
modified views and checks for GitHub BaseUrl usage
1 parent 2100eb5 commit baa7066

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

client/src/components/apps/form.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,10 +1802,13 @@ export default defineComponent({
18021802
(v: any) => /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(v) || 'Allowed characters : [a-zA-Z0-9_-]',
18031803
],
18041804
repositoryRules: [
1805-
//v => !!v || 'Repository is required',
1806-
(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
1805+
//(v: any) => !!v || 'Repository is required',
1806+
//(v: any) => v.length <= 120 || 'Repository must be less than 120 characters',
18071807
// ((git|ssh|http(s)?)|(git@[\w\.]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
1808-
(v: any) => /((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:/\-~]+)(\.git)(\/)?/.test(v) || 'Format "owner/repository"',
1808+
// ((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:\/\-~]+)(\.git)
1809+
// (git@[\w.]+:\/\/)([\w.\/\-~]+)(\.git) // not working
1810+
// ((git|ssh|http(s)?)|(git@[\w\.-]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?
1811+
(v: any) => /^((git|ssh|http(s)?)|(git@[\w\.-]+))(:(\/\/)?)([\w\.@\:\/\-~]+)(\.git)(\/)?/.test(v) || 'Format "[email protected]:organisation/repository.git"',
18091812
],
18101813
domainRules: [
18111814
(v: any) => !!v || 'Domain is required',

client/src/components/settings/form-deployment.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,19 @@
5454

5555
<h4 class="text-uppercase">Github</h4>
5656
<v-row>
57+
<v-col
58+
cols="12"
59+
md="3"
60+
>
61+
<v-text-field
62+
v-model="settings.secrets.GITHUB_BASEURL"
63+
label="github Base Url"
64+
required
65+
></v-text-field>
66+
</v-col>
5767
<v-col
5868
cols="12"
59-
md="6"
69+
md="3"
6070
>
6171
<v-text-field
6272
v-model="settings.secrets.GITHUB_PERSONAL_ACCESS_TOKEN"
@@ -218,4 +228,4 @@ export default defineComponent({
218228
}
219229
})
220230
221-
</script>
231+
</script>

client/src/components/settings/form.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import FormNotifications from './form-notifications.vue'
6565
6666
// types & interfaces
6767
export interface Secrets {
68+
GITHUB_BASEURL: string;
6869
GITHUB_PERSONAL_ACCESS_TOKEN: string;
6970
GITEA_PERSONAL_ACCESS_TOKEN: string;
7071
GITEA_BASEURL: string;
@@ -389,6 +390,7 @@ export default defineComponent({
389390
show: false,
390391
settings: {
391392
secrets: {
393+
GITHUB_BASEURL: '',
392394
GITHUB_PERSONAL_ACCESS_TOKEN: '',
393395
GITEA_PERSONAL_ACCESS_TOKEN: '',
394396
GITEA_BASEURL: '',
@@ -548,4 +550,4 @@ export default defineComponent({
548550
</script>
549551

550552
<style lang="scss">
551-
</style>
553+
</style>

server/src/git/github.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ import { RequestError } from '@octokit/types';
1212
export class GithubApi extends Repo {
1313
private octokit: any;
1414

15-
constructor(token: string) {
15+
constructor(baseUrl: string, token: string) {
1616
super("github");
17+
18+
if (baseUrl === '') {
19+
baseUrl = 'https://api.github.com';
20+
}
21+
1722
this.octokit = new Octokit({
18-
auth: token
23+
auth: token,
24+
baseUrl: baseUrl,
1925
});
2026
}
2127

@@ -398,4 +404,4 @@ export class GithubApi extends Repo {
398404

399405
return ret;
400406
}
401-
}
407+
}

server/src/modules/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class Settings {
6464
}
6565

6666
config["secrets"] = {
67+
GITHUB_BASEURL: process.env.GITHUB_BASEURL || '',
6768
GITHUB_PERSONAL_ACCESS_TOKEN: process.env.GITHUB_PERSONAL_ACCESS_TOKEN || '',
6869
GITEA_PERSONAL_ACCESS_TOKEN: process.env.GITEA_PERSONAL_ACCESS_TOKEN || '',
6970
GITEA_BASEURL: process.env.GITEA_BASEURL || '',
@@ -143,6 +144,7 @@ export class Settings {
143144
process.env[key] = secrets[key]
144145
}
145146
*/
147+
process.env.GITHUB_BASEURL = secrets.GITHUB_BASEURL
146148
process.env.GITHUB_PERSONAL_ACCESS_TOKEN = secrets.GITHUB_PERSONAL_ACCESS_TOKEN
147149
process.env.GITEA_PERSONAL_ACCESS_TOKEN = secrets.GITEA_PERSONAL_ACCESS_TOKEN
148150
process.env.GITEA_BASEURL = secrets.GITEA_BASEURL

0 commit comments

Comments
 (0)