Skip to content

Commit

Permalink
0.3.0 Getting there slowly, infrastructure improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sebt3 committed Mar 22, 2024
1 parent bdec84d commit 0d4855e
Show file tree
Hide file tree
Showing 150 changed files with 183,591 additions and 4,830 deletions.
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,11 @@
!/front/queries/vynil/InstallPrepare.graphql
/front/routes/index.ts
/front/routes/*/*
/front/components/**/*.vue
!/front/components/core/*
!/front/components/navigation/*
!/front/components/charts/*
!/front/components/vynil/PackageList.vue
!/front/components/vynil/CategoryList.vue
!/front/components/vynil/PackageMeta.vue
!/front/components/vynil/CategoryMeta.vue
/front/libs/**/*.ts
!/front/libs/*/custom.ts
!/front/libs/i18n/*
!/front/libs/core/*
/front/libs/core/importer.ts
/front/pages/**/*.vue
!/front/pages/core/*.vue
!/front/pages/install/vynil/DistribView.vue
!/front/pages/install/vynil/InstallView.vue
!/front/pages/install/vynil/InstallEdit.vue
!/front/pages/install/vynil/InstallNew.vue
7 changes: 5 additions & 2 deletions back/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const envMapping = [
// Frontend config
{name: 'defaultNamespace', key: "GRAMO_DEFAULT_NAMESPACE"},
{name: 'defaultRoute', key: "GRAMO_DEFAULT_ROUTE"},
{name: 'gramoAppName', key: "GRAMO_APP_NAME"},
];
export const defaultConfig = {
enableGraphQLClient: false,
Expand All @@ -21,14 +22,16 @@ export const defaultConfig = {
vynilNamespace: "vynil",
defaultNamespace: "default",
defaultRoute: "",
gramoVersion: "",
gramoAppName: "Gramo"
};
export function getConfig() {
const config = defaultConfig
if (typeof window !== 'undefined') return defaultConfig
envMapping.forEach(item =>{
const env = process.env[item.key] || ""
if (env!="") {
switch(typeof config[item.name]){
switch(typeof defaultConfig[item.name]){
case 'boolean':
switch(env) {
case "false":
Expand Down Expand Up @@ -59,4 +62,4 @@ export function getConfig() {
return config
}
export const gramoConfig = getConfig();
export type gramoConfigType = ReturnType<typeof getConfig>;
export type gramoConfigType = typeof defaultConfig;
2 changes: 1 addition & 1 deletion back/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ app.use((req, res, next) => {
})

await new Promise<void>((resolve) => httpServer.listen({ port: 3000 }, resolve));
console.log(`🚀 Server ready at http://localhost:3000/graphql`);
console.log(`☆ Gramo ☆ ready at http://localhost:3000/graphql`);
2 changes: 1 addition & 1 deletion back/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ app.get('*', (req, res) => {
});

await new Promise<void>((resolve) => httpServer.listen({ port: 3000 }, resolve));
console.log(`🚀 Server ready at http://localhost:3000/graphql`);
console.log(`☆ Gramo ☆ ready at http://localhost:3000/`);
6 changes: 6 additions & 0 deletions back/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ const typeDefs = gqlWrapper(
importGraphQL('cilium.graphql'),
importGraphQL('namecheap.graphql'),
importGraphQL('tekton.graphql'),
importGraphQL('argoproj.graphql'),
importGraphQL('fission.graphql'),
importGraphQL('keda.graphql'),
importGraphQL('min.graphql'),
importGraphQL('operators.graphql'),
importGraphQL('whereabouts.graphql'),
);

interface MyContext {
Expand Down
4 changes: 2 additions & 2 deletions back/resolvers/core/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { gramoConfig } from '../../config.js'
import { queries as containerQueries, resolvers as containerResolvers, mutations as containerMutations } from './Container.js';
import { queries as eventQueries, resolvers as eventResolvers, mutations as eventMutations } from './Event.js';
import { queries as crdObjectQueries, resolvers as crdObjectResolvers, mutations as crdObjectMutations } from './CrdObject.js';

import { version } from '../../version.js'
export const queries = {
gramoConfig: () => gramoConfig,
gramoConfig: () => {return {...gramoConfig, gramoVersion: version } },
...containerQueries,
...eventQueries,
...crdObjectQueries,
Expand Down
2 changes: 2 additions & 0 deletions back/schema/core.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ type GramoConfig {
limitNamespaceKey: String!
limitNamespaceValue: String!
limitNamespaceHave: String!
gramoVersion: String!
gramoAppName: String!
}

input Label {
Expand Down
9 changes: 9 additions & 0 deletions back/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const path_root = process.env.NODE_ENV !== 'production'?path.resolve(__dirname, '..'):__dirname;
function LoadFrom(filename:string){
return JSON.parse(fs.readFileSync(filename).toLocaleString())
}
export const version = LoadFrom(path.resolve(path_root,'package.json')).version as string
Loading

0 comments on commit 0d4855e

Please sign in to comment.