Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #82 from AtkinsSJ/sdk-url-config
Browse files Browse the repository at this point in the history
Set the Puter SDK URL in the config
  • Loading branch information
KernelDeimos authored Apr 12, 2024
2 parents 6ac511e + 42d587a commit 2ef907d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="xterm.css">
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
<script src="https://puter.com/puter.js/v2"></script>
<script src="__SDK_URL__"></script>
<script src="config.js"></script>
<script src="bundle.js"></script>
<script>
Expand Down
3 changes: 2 additions & 1 deletion config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
"origin": "https://puter.local:8080",
"shell.href": "https://puter.local:8081"
"shell.href": "https://puter.local:8081",
"sdk_url": "http://puter.localhost:4100/sdk/puter.js",
};
3 changes: 2 additions & 1 deletion config/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
origin: location.origin,
'shell.href': location.origin + '/puter-shell/'
'shell.href': location.origin + '/puter-shell/',
sdk_url: 'https://puter.com/puter.js/v2',
};
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';

const configFile = process.env.CONFIG_FILE ?? 'config/dev.js';
await import(`./${configFile}`);

export default {
input: "src/main_puter.js",
Expand All @@ -33,7 +34,13 @@ export default {
commonjs(),
copy({
targets: [
{ src: 'assets/index.html', dest: 'dist' },
{
src: 'assets/index.html',
dest: 'dist',
transform: (contents, name) => {
return contents.toString().replace('__SDK_URL__', globalThis.__CONFIG__.sdk_url);
}
},
{ src: 'assets/shell.html', dest: 'dist' },
{ src: 'assets/normalize.css', dest: 'dist' },
{ src: 'assets/style.css', dest: 'dist' },
Expand Down

0 comments on commit 2ef907d

Please sign in to comment.