Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ You can now access the application at http://localhost:8080/

Environment variables:
- `SERVER_URL` (Optional): The backend server URL. When set the server input on the login page will not be displayed.
- `INSTANCE_NAME` (Optional): The name of this airsonic-refix instance. Will be displayed in the UI.
- `INSTANCE_SUBNAME` (Optional): The second name that follow INSTANCE_NAME on the right of the logo. Will be displayed in the UI.
- `DISABLE_SUBNAME` (Optional): Values `true`, `false`. Ability to disable the subname in the navbar.


### Pre-built bundle
Expand Down
3 changes: 3 additions & 0 deletions docker/env.js.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
window.env = {
SERVER_URL: "$SERVER_URL",
INSTANCE_NAME: "$INSTANCE_NAME",
INSTANCE_SUBNAME: "$INSTANCE_SUBNAME",
DISABLE_SUBNAME: $DISABLE_SUBNAME,
}
18 changes: 16 additions & 2 deletions src/app/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,25 @@
</g>
</svg>
<span class="text-body ml-2 text-nowrap">
<span>airsonic&nbsp;</span>
<span class="text-muted">(refix)</span>
<span>{{instanceName}}&nbsp;</span>
<span v-if="!disableSubName" class="text-muted">({{instanceSubName}})</span>
</span>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { config } from '@/shared/config'

export default defineComponent({
data() {
return {
instanceName: config.instanceName,
instanceSubName: config.instanceSubName,
disableSubName: config.disableSubName
}
},
})
</script>
<style scoped>
svg {
fill: var(--primary);
Expand Down
6 changes: 6 additions & 0 deletions src/shared/config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
export interface Config {
serverUrl: string
instanceName: string
instanceSubName: string
disableSubName: boolean
}

const env = (window as any).env

export const config: Config = {
serverUrl: env?.SERVER_URL || '',
instanceName: env?.INSTANCE_NAME || 'airsonic',
instanceSubName: env?.INSTANCE_SUBNAME || 'refix',
disableSubName: env?.DISABLE_SUBNAME ? Boolean(env.DISABLE_SUBNAME) : false,
}