Skip to content

Commit

Permalink
Simplify connecting to Galaxy instance
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Oct 29, 2024
1 parent d55daa3 commit c9ec0d7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
6 changes: 3 additions & 3 deletions docs/content/configuration.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Connect to Galaxy

Galaxy Charts can be used to develop Visualizations independently of Galaxy. However, visualization may access to the Galaxy API in order to retrive datasets, metadata or run jobs. In the Galaxy Charts standalone application can be connected to the API of a local or public runnning Galaxy instance by providing the `GALAXY_API` route either as environment variable, when running Galaxy Charts:
Galaxy Charts can be used to develop Visualizations independently of Galaxy. However, visualization may access to the Galaxy API in order to retrive datasets, metadata or run jobs. In the Galaxy Charts standalone application can be connected to the API of a local or public runnning Galaxy instance by providing the `GALAXY_ROOT` route either as environment variable, when running Galaxy Charts:

```md
GALAXY_API="http://127.0.0.1:8081/api" yarn dev
GALAXY_ROOT="http://127.0.0.1:8080" yarn dev
```

or by specifying the corresponding route in the `server.config.js` file as show here:
```md
export default {
GALAXY_API: "http://127.0.0.1:8081/api",
GALAXY_ROOT: "http://127.0.0.1:8080",
};
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"charts"
],
"license": "MIT",
"version": "0.0.10",
"version": "0.0.11",
"type": "module",
"main": "./dist/galaxy-charts.umd.cjs",
"module": "./dist/galaxy-charts.js",
Expand Down
2 changes: 1 addition & 1 deletion server.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
GALAXY_API: "http://127.0.0.1:8081/api",
GALAXY_ROOT: "http://127.0.0.1:8080",
};
6 changes: 4 additions & 2 deletions src/components/ApiStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ async function checkVersion() {
try {
version.value = await versionGet(props.root);
} catch (err) {
console.error(err);
console.log(
"Unable to connect to Galaxy. Verify Galaxy is running and properly configured in `server.config.js`.",
);
version.value = "";
}
}
Expand All @@ -40,6 +42,6 @@ checkVersion();
<ExclamationCircleIcon class="text-red-600" />
</n-icon>
</template>
<span class="text-xs">Galaxy not available</span>
<span class="text-xs">Galaxy is not running or not configured: `server.config.js`.</span>
</n-tooltip>
</template>
1 change: 0 additions & 1 deletion src/utilities/simpleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ export function errorMessageAsString(e: any, defaultMessage = "Request failed.")
}

export function rethrowSimple(e: any): never {
console.error(e);
throw Error(errorMessageAsString(e));
}
14 changes: 7 additions & 7 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { libInjectCss } from "vite-plugin-lib-inject-css";
import { configDefaults } from "vitest/config";

// determine server route
let GALAXY_API = "";
if (process.env.GALAXY_API) {
GALAXY_API = process.env.GALAXY_API;
} else if (serverConfig.GALAXY_API) {
GALAXY_API = serverConfig.GALAXY_API;
let GALAXY_ROOT = "";
if (process.env.GALAXY_ROOT) {
GALAXY_ROOT = process.env.GALAXY_ROOT;
} else if (serverConfig.GALAXY_ROOT) {
GALAXY_ROOT = serverConfig.GALAXY_ROOT;
} else {
console.warn("GALAXY_API not available. Please provide as environment variable or specify in 'server.config'.");
console.warn("GALAXY_ROOT not available. Please provide as environment variable or specify in 'server.config'.");
}

// https://vitejs.dev/config/
Expand All @@ -40,7 +40,7 @@ export default defineConfig({
server: {
proxy: {
"/api": {
target: GALAXY_API,
target: GALAXY_ROOT + "/api",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
Expand Down

0 comments on commit c9ec0d7

Please sign in to comment.